Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Unified Diff: test/js-perf-test/Collections/weakset.js

Issue 685753004: Add performance tests for Map/Set with String and Object keys (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address dslomov comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/js-perf-test/Collections/weakmap.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
+ }
}
« no previous file with comments | « test/js-perf-test/Collections/weakmap.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698