Index: test/js-perf-test/Collections/weakset.js |
diff --git a/test/js-perf-test/Collections/weakset.js b/test/js-perf-test/Collections/weakset.js |
index a7d0f3d076fe3807f41d1cd4d6da60bf586792b6..2936477b3597b252c8fa03401304c5d01019e794 100644 |
--- a/test/js-perf-test/Collections/weakset.js |
+++ b/test/js-perf-test/Collections/weakset.js |
@@ -4,7 +4,8 @@ |
var SetBenchmark = new BenchmarkSuite('WeakSet', [1000], [ |
- new Benchmark('Add', false, false, 0, WeakSetAdd), |
+ new Benchmark('Add', false, false, 0, WeakSetAdd, WeakSetSetupBase, |
+ WeakSetTearDown), |
new Benchmark('Has', false, false, 0, WeakSetHas, WeakSetSetup, |
WeakSetTearDown), |
new Benchmark('Delete', false, false, 0, WeakSetDelete, WeakSetSetup, |
@@ -13,20 +14,17 @@ var SetBenchmark = new BenchmarkSuite('WeakSet', [1000], [ |
var ws; |
-var N = 10; |
-var keys = []; |
-for (var i = 0; i < N * 2; i++) { |
- keys[i] = {}; |
+function WeakSetSetupBase() { |
+ SetupObjectKeys(); |
+ ws = new WeakSet; |
} |
function WeakSetSetup() { |
- ws = new WeakSet; |
- for (var i = 0; i < N; i++) { |
- ws.add(keys[i]); |
- } |
+ WeakSetSetupBase(); |
+ WeakSetAdd(); |
} |
@@ -36,8 +34,9 @@ function WeakSetTearDown() { |
function WeakSetAdd() { |
- WeakSetSetup(); |
- WeakSetTearDown(); |
+ for (var i = 0; i < N; i++) { |
+ ws.add(keys[i]); |
+ } |
} |