Commit 9298d218 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

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

Bug: v8:8557
Change-Id: I213b5944de72eb09a18e44789539b6b420e68068
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1538117Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60430}
parent ea3197f9
......@@ -15,7 +15,12 @@ var MapBenchmark = new BenchmarkSuite('WeakMap', [1000], [
]);
var MapBenchmark = new BenchmarkSuite('WeakMapSetGet-Large', [1e7], [
new Benchmark('Set-Get', false, false, 0, WeakMapSetGetLarge,
new Benchmark('Set-Get', false, true, 1, WeakMapSetGetLarge,
WeakMapSetupBaseLarge, WeakMapTearDown),
]);
var MapBenchmark = new BenchmarkSuite('WeakMapSet-Huge', [1e8], [
new Benchmark('Set-Get', false, true, 1, WeakMapSetHuge,
WeakMapSetupBaseLarge, 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,14 @@ function WeakMapSetGetLarge() {
}
}
}
function WeakMapSetHuge() {
function Foo(i) {
this.x = i;
}
let obj;
for (let i = 0; i < LargeN; i++) {
obj = new Foo(i); // Make sure we do not scalar-replace the object.
wm.set(obj, 1);
}
}
......@@ -39,6 +39,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