[js-perf-test] Add additional benchmarks for boolean constructor
Bug: v8:9240 Change-Id: I704e0932b00baf84c4203baa8336809b250855d9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1611681 Commit-Queue: Nico Hartmann <nicohartmann@google.com> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#61507}
This commit is contained in:
parent
376d242fbf
commit
099669ecf3
@ -4,23 +4,27 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ITERATIONS = 10000;
|
||||
const ITERATIONS = 100000;
|
||||
|
||||
// This dummy ensures that the feedback for benchmark.run() in the Measure function
|
||||
// from base.js is not monomorphic, thereby preventing the benchmarks below from being inlined.
|
||||
// This ensures consistent behavior and comparable results.
|
||||
new BenchmarkSuite('Prevent-Inline-Dummy', [1000], [
|
||||
new BenchmarkSuite('Prevent-Inline-Dummy', [10000], [
|
||||
new Benchmark('Prevent-Inline-Dummy', true, false, 0, () => {})
|
||||
]);
|
||||
|
||||
new BenchmarkSuite('BigInt-ToBoolean', [1000], [
|
||||
new BenchmarkSuite('BigInt-ToBoolean', [10000], [
|
||||
new Benchmark('BigInt-ToBoolean', true, false, 0, TestToBoolean),
|
||||
]);
|
||||
|
||||
new BenchmarkSuite('BigInt-BooleanConstructor', [1000], [
|
||||
new BenchmarkSuite('BigInt-BooleanConstructor', [10000], [
|
||||
new Benchmark('BigInt-BooleanConstructor', true, false, 0, TestBooleanConstructor),
|
||||
]);
|
||||
|
||||
new BenchmarkSuite('BigInt-NewBooleanConstructor', [10000], [
|
||||
new Benchmark('BigInt-NewBooleanConstructor', true, false, 0, TestNewBooleanConstructor),
|
||||
]);
|
||||
|
||||
|
||||
function TestBooleanConstructor() {
|
||||
let kl = true;
|
||||
@ -33,6 +37,17 @@ function TestBooleanConstructor() {
|
||||
}
|
||||
|
||||
|
||||
function TestNewBooleanConstructor() {
|
||||
let kl = true;
|
||||
for (let i = 0; i < ITERATIONS; ++i) {
|
||||
// Store to a variable to prevent elimination.
|
||||
// Keep a depedency on the loop counter to prevent hoisting.
|
||||
kl = new Boolean(i % 2 == 0 ? 42n : 32n);
|
||||
}
|
||||
return kl;
|
||||
}
|
||||
|
||||
|
||||
function TestToBoolean() {
|
||||
let kl = true;
|
||||
for (let i = 0; i < ITERATIONS; ++i) {
|
||||
|
@ -55,7 +55,23 @@
|
||||
"results_regexp": "^%s\\-BigInt\\(Score\\): (.+)$",
|
||||
"tests": [
|
||||
{ "name": "BigInt-ToBoolean" },
|
||||
{ "name": "BigInt-BooleanConstructor" }
|
||||
{ "name": "BigInt-BooleanConstructor" },
|
||||
{ "name": "BigInt-NewBooleanConstructor" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "BigInt-Jitless",
|
||||
"path": ["BigInt"],
|
||||
"main": "run.js",
|
||||
"resources": [
|
||||
"to-boolean.js"
|
||||
],
|
||||
"flags": ["--jitless"],
|
||||
"results_regexp": "^%s\\-BigInt\\(Score\\): (.+)$",
|
||||
"tests": [
|
||||
{ "name": "BigInt-ToBoolean" },
|
||||
{ "name": "BigInt-BooleanConstructor" },
|
||||
{ "name": "BigInt-NewBooleanConstructor" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user