Skip to content

Commit eefdf45

Browse files
targosjasnell
authored andcommitted
benchmark: avoid TurboFan deopt in arrays bench
Something unidentified at the moment is causing the arrays benchmarks to deopt when run with the TurboFan compiler. Refactor the test to use an inner function that can be correctly optimized by TurboFan and Crankshaft. PR-URL: #11894 Ref: #11851 (comment) Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent e9f2ec4 commit eefdf45

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

benchmark/arrays/var-int.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ function main(conf) {
2727
bench.start();
2828
var arr = new clazz(n * 1e6);
2929
for (var i = 0; i < 10; ++i) {
30+
run();
31+
}
32+
bench.end(n);
33+
34+
function run() {
3035
for (var j = 0, k = arr.length; j < k; ++j) {
3136
arr[j] = (j ^ k) & 127;
3237
}
3338
}
34-
bench.end(n);
3539
}

benchmark/arrays/zero-float.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ function main(conf) {
2727
bench.start();
2828
var arr = new clazz(n * 1e6);
2929
for (var i = 0; i < 10; ++i) {
30+
run();
31+
}
32+
bench.end(n);
33+
34+
function run() {
3035
for (var j = 0, k = arr.length; j < k; ++j) {
3136
arr[j] = 0.0;
3237
}
3338
}
34-
bench.end(n);
3539
}

benchmark/arrays/zero-int.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ function main(conf) {
2727
bench.start();
2828
var arr = new clazz(n * 1e6);
2929
for (var i = 0; i < 10; ++i) {
30+
run();
31+
}
32+
bench.end(n);
33+
34+
function run() {
3035
for (var j = 0, k = arr.length; j < k; ++j) {
3136
arr[j] = 0;
3237
}
3338
}
34-
bench.end(n);
3539
}

0 commit comments

Comments
 (0)