Commit 62a8bdca authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[js-perf-test] Add more WeakMap perf tests

Change-Id: I46eb94e58fc4da55cb1b2adb9ffdbb09e5e33a5d
Bug: v8:8557
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1530800Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60326}
parent 2328b5ad
......@@ -19,6 +19,11 @@ var MapBenchmark = new BenchmarkSuite('WeakMapSetGet-Large', [1e7], [
WeakMapSetupBaseLarge, WeakMapTearDown),
]);
var MapBenchmark = new BenchmarkSuite('WeakMapSet-Huge', [1e8], [
new Benchmark('Set-Get', false, false, 0, WeakMapSetHuge,
WeakMapSetupBaseLarge, WeakMapTearDown),
]);
var MapBenchmark = new BenchmarkSuite('WeakMap-Constructor', [1000], [
new Benchmark('Constructor', false, false, 0, WeakMapConstructor, SetupObjectKeyValuePairs,
WeakMapTearDown),
......@@ -92,7 +97,7 @@ function WeakMapGet() {
function WeakMapDelete() {
// This is run more than once per setup so we will end up deleting items
// more than once. Therefore, we do not the return value of delete.
// more than once. Therefore, we do not check the return value of delete.
for (var i = 0; i < N; i++) {
wm.delete(keys[i]);
}
......@@ -113,3 +118,15 @@ function WeakMapSetGetLarge() {
}
}
}
function WeakMapSetHuge() {
function Foo(i) {
this.x = i;
}
const N = 50 * 1000;
let obj;
for (let i = 0; i < N; i++) {
obj = new Foo(i); // Make sure we do not scalar-replace the object.
wm.set(obj, 1);
}
}
......@@ -380,6 +380,8 @@
{"name": "Set-Iterator"},
{"name": "WeakMap"},
{"name": "WeakMap-Constructor"},
{"name": "WeakMapSetGet-Large"},
{"name": "WeakMapSet-Huge"},
{"name": "WeakSet"},
{"name": "WeakSet-Constructor"}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment