[TurboFan] Remove inappropriate perf tests for BigInt multiply
Bug: v8:9407 Change-Id: I978f6d81c01bdf86131beca5a756181f23b0ed52 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3789500 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Commit-Queue: Qifan Pan <panq@google.com> Cr-Commit-Position: refs/heads/main@{#82005}
This commit is contained in:
parent
ef08fdd8c8
commit
2d367eb352
@ -6,8 +6,6 @@
|
||||
|
||||
d8.file.execute('bigint-util.js');
|
||||
|
||||
let initial_product = 0n;
|
||||
let a = 0n;
|
||||
let random_bigints = [];
|
||||
|
||||
// This dummy ensures that the feedback for benchmark.run() in the Measure
|
||||
@ -19,97 +17,41 @@ new BenchmarkSuite('Prevent-Inline-Dummy', [10000], [
|
||||
]);
|
||||
|
||||
|
||||
new BenchmarkSuite('Multiply-TypeError', [10000], [
|
||||
new Benchmark('Multiply-TypeError', true, false, 0, TestMultiplyTypeError,
|
||||
SetUpTestMultiplyTypeError)
|
||||
new BenchmarkSuite('Multiply-Zero', [1000], [
|
||||
new Benchmark('Multiply-Zero', true, false, 0, TestMultiplyZero)
|
||||
]);
|
||||
|
||||
|
||||
new BenchmarkSuite('Multiply-One', [1000], [
|
||||
new Benchmark('Multiply-One', true, false, 0, TestMultiplyOne, SetUpTestMultiplyOne)
|
||||
new BenchmarkSuite('Multiply-Small', [1000], [
|
||||
new Benchmark('Multiply-Small', true, false, 0, TestMultiplySmall)
|
||||
]);
|
||||
|
||||
|
||||
// BIT_CASES are divided into three subcases with different references
|
||||
// to ensure the scores fall into the range of 100-10000
|
||||
SMALL_BITS_CASES.forEach((d) => {
|
||||
new BenchmarkSuite(`Multiply-${d}`, [100], [
|
||||
new Benchmark(`Multiply-${d}`, true, false, 0, TestMultiply,
|
||||
() => SetUpTestMultiply(d))
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
MEDIUM_BITS_CASES.forEach((d) => {
|
||||
new BenchmarkSuite(`Multiply-${d}`, [1000], [
|
||||
new Benchmark(`Multiply-${d}`, true, false, 0, TestMultiply,
|
||||
() => SetUpTestMultiply(d))
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
BIG_BITS_CASES.forEach((d) => {
|
||||
new BenchmarkSuite(`Multiply-${d}`, [100000], [
|
||||
new Benchmark(`Multiply-${d}`, true, false, 0, TestMultiply,
|
||||
() => SetUpTestMultiply(d))
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
new BenchmarkSuite('Multiply-Random', [10000], [
|
||||
new Benchmark('Multiply-Random', true, false, 0, TestMultiplyRandom,
|
||||
SetUpTestMultiplyRandom)
|
||||
]);
|
||||
|
||||
|
||||
function SetUpTestMultiplyTypeError() {
|
||||
initial_product = 42n;
|
||||
function TestMultiplyZero() {
|
||||
let sum = 0n;
|
||||
|
||||
for (let i = 0n; i < TEST_ITERATIONS; ++i) {
|
||||
sum += 0n * i;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
function TestMultiplyTypeError() {
|
||||
let product = initial_product;
|
||||
for (let i = 0; i < SLOW_TEST_ITERATIONS; ++i) {
|
||||
try {
|
||||
product = 3 * product;
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
}
|
||||
return product;
|
||||
}
|
||||
function TestMultiplySmall() {
|
||||
let sum = 0n;
|
||||
|
||||
|
||||
function SetUpTestMultiplyOne() {
|
||||
initial_product = 42n;
|
||||
}
|
||||
|
||||
|
||||
function TestMultiplyOne() {
|
||||
let product = initial_product;
|
||||
|
||||
for (let i = 0; i < TEST_ITERATIONS; ++i) {
|
||||
product = 1n * product;
|
||||
for (let i = 0n; i < TEST_ITERATIONS; ++i) {
|
||||
sum += i * (i + 1n);
|
||||
}
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
|
||||
function SetUpTestMultiply(bits) {
|
||||
initial_product = SmallRandomBigIntWithBits(bits);
|
||||
a = SmallRandomBigIntWithBits(bits);
|
||||
}
|
||||
|
||||
|
||||
function TestMultiply() {
|
||||
let product = initial_product;
|
||||
|
||||
for (let i = 0; i < SLOW_TEST_ITERATIONS; ++i) {
|
||||
product = a * product;
|
||||
}
|
||||
|
||||
return product;
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +59,7 @@ function SetUpTestMultiplyRandom() {
|
||||
random_bigints = [];
|
||||
// RandomBigIntWithBits needs multiples of 4 bits.
|
||||
const max_in_4bits = RANDOM_BIGINTS_MAX_BITS / 4;
|
||||
for (let i = 0; i < SLOW_TEST_ITERATIONS; ++i) {
|
||||
for (let i = 0; i < TEST_ITERATIONS; ++i) {
|
||||
const bits = Math.floor(Math.random() * max_in_4bits) * 4;
|
||||
const bigint = RandomBigIntWithBits(bits);
|
||||
random_bigints.push(Math.random() < 0.5 ? -bigint : bigint);
|
||||
@ -126,11 +68,11 @@ function SetUpTestMultiplyRandom() {
|
||||
|
||||
|
||||
function TestMultiplyRandom() {
|
||||
let product = 1n;
|
||||
let sum = 0n;
|
||||
|
||||
for (let i = 0; i < SLOW_TEST_ITERATIONS; ++i) {
|
||||
product = random_bigints[i] * product;
|
||||
for (let i = 0; i < TEST_ITERATIONS - 1; ++i) {
|
||||
sum = random_bigints[i] * random_bigints[i + 1];
|
||||
}
|
||||
|
||||
return product;
|
||||
return sum;
|
||||
}
|
||||
|
@ -167,17 +167,8 @@
|
||||
"test_flags": ["multiply"],
|
||||
"results_regexp": "^BigInt\\-%s\\(Score\\): (.+)$",
|
||||
"tests": [
|
||||
{ "name": "Multiply-TypeError" },
|
||||
{ "name": "Multiply-One" },
|
||||
{ "name": "Multiply-32" },
|
||||
{ "name": "Multiply-64" },
|
||||
{ "name": "Multiply-128" },
|
||||
{ "name": "Multiply-256" },
|
||||
{ "name": "Multiply-512" },
|
||||
{ "name": "Multiply-1024" },
|
||||
{ "name": "Multiply-2048" },
|
||||
{ "name": "Multiply-4096" },
|
||||
{ "name": "Multiply-8192" },
|
||||
{ "name": "Multiply-Zero" },
|
||||
{ "name": "Multiply-Small"},
|
||||
{ "name": "Multiply-Random" }
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user