diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-01-23 13:19:30 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-01 10:49:04 +0100 |
commit | 1b6cb947611de5865641d1a6780ee6930a4e1d69 (patch) | |
tree | 279384c2b3bde394f8a8b3f543fdc0725ef1b93f /benchmark/misc | |
parent | c713f079f1bd1c575487c693f3f9244bed460ee1 (diff) | |
download | android-node-v8-1b6cb947611de5865641d1a6780ee6930a4e1d69.tar.gz android-node-v8-1b6cb947611de5865641d1a6780ee6930a4e1d69.tar.bz2 android-node-v8-1b6cb947611de5865641d1a6780ee6930a4e1d69.zip |
benchmark: refactor
PR-URL: https://github.com/nodejs/node/pull/18320
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/misc')
-rw-r--r-- | benchmark/misc/freelist.js | 3 | ||||
-rw-r--r-- | benchmark/misc/function_call/index.js | 4 | ||||
-rw-r--r-- | benchmark/misc/object-property-bench.js | 2 | ||||
-rw-r--r-- | benchmark/misc/punycode.js | 5 |
4 files changed, 5 insertions, 9 deletions
diff --git a/benchmark/misc/freelist.js b/benchmark/misc/freelist.js index 0530255728..8c3281cc40 100644 --- a/benchmark/misc/freelist.js +++ b/benchmark/misc/freelist.js @@ -12,7 +12,6 @@ function main({ n }) { const FreeList = require('internal/freelist'); const poolSize = 1000; const list = new FreeList('test', poolSize, Object); - var i; var j; const used = []; @@ -23,7 +22,7 @@ function main({ n }) { bench.start(); - for (i = 0; i < n; i++) { + for (var i = 0; i < n; i++) { // Return all the items to the pool for (j = 0; j < poolSize; j++) { list.free(used[j]); diff --git a/benchmark/misc/function_call/index.js b/benchmark/misc/function_call/index.js index 91efa57359..28561bc48c 100644 --- a/benchmark/misc/function_call/index.js +++ b/benchmark/misc/function_call/index.js @@ -32,11 +32,9 @@ const bench = common.createBenchmark(main, { }); function main({ millions, type }) { - const n = millions * 1e6; - const fn = type === 'cxx' ? cxx : js; bench.start(); - for (var i = 0; i < n; i++) { + for (var i = 0; i < millions * 1e6; i++) { fn(); } bench.end(millions); diff --git a/benchmark/misc/object-property-bench.js b/benchmark/misc/object-property-bench.js index 37da82d887..ddc6faed7f 100644 --- a/benchmark/misc/object-property-bench.js +++ b/benchmark/misc/object-property-bench.js @@ -78,6 +78,6 @@ function main({ millions, method }) { runSymbol(n); break; default: - throw new Error('Unexpected method'); + throw new Error(`Unexpected method "${method}"`); } } diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index 7016fa1171..369adcf17d 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -55,9 +55,8 @@ function runPunycode(n, val) { } function runICU(n, val) { - var i = 0; bench.start(); - for (; i < n; i++) + for (var i = 0; i < n; i++) usingICU(val); bench.end(n); } @@ -76,6 +75,6 @@ function main({ n, val, method }) { } // fallthrough default: - throw new Error('Unexpected method'); + throw new Error(`Unexpected method "${method}"`); } } |