diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2017-03-17 09:21:58 +0100 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-04-04 10:45:43 -0700 |
commit | eefdf452c35fd79d5588d2338989d55ebaf52763 (patch) | |
tree | a090234dc164f3f5eb68f44f192e64686c671eba | |
parent | e9f2ec4e1e590ce0b1f4a071997688f54ea52fdd (diff) | |
download | node-new-eefdf452c35fd79d5588d2338989d55ebaf52763.tar.gz |
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: https://github.com/nodejs/node/pull/11894
Ref: https://github.com/nodejs/node/issues/11851#issuecomment-287106714
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
-rw-r--r-- | benchmark/arrays/var-int.js | 6 | ||||
-rw-r--r-- | benchmark/arrays/zero-float.js | 6 | ||||
-rw-r--r-- | benchmark/arrays/zero-int.js | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/benchmark/arrays/var-int.js b/benchmark/arrays/var-int.js index 36b0a908a5..9ebad61166 100644 --- a/benchmark/arrays/var-int.js +++ b/benchmark/arrays/var-int.js @@ -27,9 +27,13 @@ function main(conf) { bench.start(); var arr = new clazz(n * 1e6); for (var i = 0; i < 10; ++i) { + run(); + } + bench.end(n); + + function run() { for (var j = 0, k = arr.length; j < k; ++j) { arr[j] = (j ^ k) & 127; } } - bench.end(n); } diff --git a/benchmark/arrays/zero-float.js b/benchmark/arrays/zero-float.js index 047e179234..a74cd8ec5b 100644 --- a/benchmark/arrays/zero-float.js +++ b/benchmark/arrays/zero-float.js @@ -27,9 +27,13 @@ function main(conf) { bench.start(); var arr = new clazz(n * 1e6); for (var i = 0; i < 10; ++i) { + run(); + } + bench.end(n); + + function run() { for (var j = 0, k = arr.length; j < k; ++j) { arr[j] = 0.0; } } - bench.end(n); } diff --git a/benchmark/arrays/zero-int.js b/benchmark/arrays/zero-int.js index 4e5c97e8af..7f61aa1a82 100644 --- a/benchmark/arrays/zero-int.js +++ b/benchmark/arrays/zero-int.js @@ -27,9 +27,13 @@ function main(conf) { bench.start(); var arr = new clazz(n * 1e6); for (var i = 0; i < 10; ++i) { + run(); + } + bench.end(n); + + function run() { for (var j = 0, k = arr.length; j < k; ++j) { arr[j] = 0; } } - bench.end(n); } |