{"ScriptPreparationCode":"var setA = new Set();\r\nvar typedSetA = new TypedFastBitSet();\r\nvar setB = new Set();\r\nvar typedSetB = new TypedFastBitSet();\r\nvar N = 100;\r\nfor (var i = 0 ; i \u003C N ; i\u002B\u002B) {\r\n setA.add(3 * i \u002B 5);\r\n typedSetA.add(3 * i \u002B 5);\r\n setB.add(6 * i \u002B 5);\r\n typedSetB.add(6 * i \u002B 5);\r\n}\r\n\r\nvar genericSetIntersection = function(set1, set2) {\r\n var answer = new Set();\r\n if (set2.length \u003E set1.length) {\r\n for (var j of set1) {\r\n if (set2.has(j)) {\r\n answer.add(j);\r\n }\r\n }\r\n } else {\r\n for (var j of set2) {\r\n if (set1.has(j)) {\r\n answer.add(j);\r\n }\r\n }\r\n }\r\n return answer;\r\n};\r\n\r\nvar genericInplaceSetIntersection = function(set1, set2) {\r\n for (var j of set2) {\r\n if (!set1.has(j)) {\r\n set1.delete(j);\r\n }\r\n }\r\n return set1;\r\n};\r\n","TestCases":[{"Name":"Set intersection (new)","Code":"genericSetIntersection(setA, setB);","IsDeferred":false},{"Name":"TypedFastBitSet intersection (new)","Code":"typedSetA.new_intersection(typedSetB);","IsDeferred":false},{"Name":"Set intersection (inplace)","Code":"genericInplaceSetIntersection(setA, setB)","IsDeferred":false},{"Name":"TypedFastBitSet intersection (inplace)","Code":"typedSetA.intersection(typedSetB);","IsDeferred":false}]}