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

Unified Diff: test/js-perf-test/Collections/weakmap.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/set.js ('k') | test/js-perf-test/Collections/weakset.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/js-perf-test/Collections/weakmap.js
diff --git a/test/js-perf-test/Collections/weakmap.js b/test/js-perf-test/Collections/weakmap.js
index 8736dfd58b7f26c54a169ce3332e5caf424feec0..9aa265f25ae915c522c7ee2ecd41f7da8088c6c1 100644
--- a/test/js-perf-test/Collections/weakmap.js
+++ b/test/js-perf-test/Collections/weakmap.js
@@ -4,7 +4,8 @@
var MapBenchmark = new BenchmarkSuite('WeakMap', [1000], [
- new Benchmark('Set', false, false, 0, WeakMapSet),
+ new Benchmark('Set', false, false, 0, WeakMapSet, WeakMapSetupBase,
+ WeakMapTearDown),
new Benchmark('Has', false, false, 0, WeakMapHas, WeakMapSetup,
WeakMapTearDown),
new Benchmark('Get', false, false, 0, WeakMapGet, WeakMapSetup,
@@ -15,20 +16,17 @@ var MapBenchmark = new BenchmarkSuite('WeakMap', [1000], [
var wm;
-var N = 10;
-var keys = [];
-for (var i = 0; i < N * 2; i++) {
- keys[i] = {};
+function WeakMapSetupBase() {
+ SetupObjectKeys();
+ wm = new WeakMap;
}
function WeakMapSetup() {
- wm = new WeakMap;
- for (var i = 0; i < N; i++) {
- wm.set(keys[i], i);
- }
+ WeakMapSetupBase();
+ WeakMapSet();
}
@@ -38,8 +36,9 @@ function WeakMapTearDown() {
function WeakMapSet() {
- WeakMapSetup();
- WeakMapTearDown();
+ for (var i = 0; i < N; i++) {
+ wm.set(keys[i], i);
+ }
}
« no previous file with comments | « test/js-perf-test/Collections/set.js ('k') | test/js-perf-test/Collections/weakset.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698