diff options
author | Ethan Arrowood <ethan.arrowood@gmail.com> | 2017-10-06 09:59:28 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-10-12 17:41:30 -0700 |
commit | af49e58211ea63d53900eb068eaa5f32ae1cf236 (patch) | |
tree | 67d7f704bcbf8e29f538231cf5440c68df499d78 /benchmark/es | |
parent | edebc902cf0191e02eb7d485d53cfd008a6d3336 (diff) | |
download | android-node-v8-af49e58211ea63d53900eb068eaa5f32ae1cf236.tar.gz android-node-v8-af49e58211ea63d53900eb068eaa5f32ae1cf236.tar.bz2 android-node-v8-af49e58211ea63d53900eb068eaa5f32ae1cf236.zip |
test: add benchmark tests for es
Added parallel test benchmark for es
PR-URL: https://github.com/nodejs/node/pull/16076
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/es')
-rw-r--r-- | benchmark/es/defaultparams-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/destructuring-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/destructuring-object-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/foreach-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/map-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/restparams-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/spread-bench.js | 2 | ||||
-rw-r--r-- | benchmark/es/string-concatenations.js | 7 | ||||
-rw-r--r-- | benchmark/es/string-repeat.js | 27 |
9 files changed, 36 insertions, 12 deletions
diff --git a/benchmark/es/defaultparams-bench.js b/benchmark/es/defaultparams-bench.js index 56d04cd95b..1393abbe54 100644 --- a/benchmark/es/defaultparams-bench.js +++ b/benchmark/es/defaultparams-bench.js @@ -42,6 +42,8 @@ function main(conf) { const n = +conf.millions * 1e6; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'withoutdefaults': runOldStyleDefaults(n); break; diff --git a/benchmark/es/destructuring-bench.js b/benchmark/es/destructuring-bench.js index 3288e009a0..a6c9a81ae0 100644 --- a/benchmark/es/destructuring-bench.js +++ b/benchmark/es/destructuring-bench.js @@ -38,6 +38,8 @@ function main(conf) { const n = +conf.millions * 1e6; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'swap': runSwapManual(n); break; diff --git a/benchmark/es/destructuring-object-bench.js b/benchmark/es/destructuring-object-bench.js index 3edfa6d60b..63e085a242 100644 --- a/benchmark/es/destructuring-object-bench.js +++ b/benchmark/es/destructuring-object-bench.js @@ -37,6 +37,8 @@ function main(conf) { const n = +conf.millions * 1e6; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'normal': runNormal(n); break; diff --git a/benchmark/es/foreach-bench.js b/benchmark/es/foreach-bench.js index 26c741b706..62aa02236f 100644 --- a/benchmark/es/foreach-bench.js +++ b/benchmark/es/foreach-bench.js @@ -63,6 +63,8 @@ function main(conf) { items[i] = i; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'for': fn = useFor; break; diff --git a/benchmark/es/map-bench.js b/benchmark/es/map-bench.js index 62ff332fd4..035ed1a22a 100644 --- a/benchmark/es/map-bench.js +++ b/benchmark/es/map-bench.js @@ -112,6 +112,8 @@ function main(conf) { const n = +conf.millions * 1e6; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'object': runObject(n); break; diff --git a/benchmark/es/restparams-bench.js b/benchmark/es/restparams-bench.js index d893af48f4..32fa985ded 100644 --- a/benchmark/es/restparams-bench.js +++ b/benchmark/es/restparams-bench.js @@ -64,6 +64,8 @@ function main(conf) { const n = +conf.millions * 1e6; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'copy': runCopyArguments(n); break; diff --git a/benchmark/es/spread-bench.js b/benchmark/es/spread-bench.js index a9416ad90e..b6dfb5963e 100644 --- a/benchmark/es/spread-bench.js +++ b/benchmark/es/spread-bench.js @@ -33,6 +33,8 @@ function main(conf) { args[i] = i; switch (conf.method) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'apply': bench.start(); for (i = 0; i < n; i++) diff --git a/benchmark/es/string-concatenations.js b/benchmark/es/string-concatenations.js index 8bdaefa4da..b7f5c31936 100644 --- a/benchmark/es/string-concatenations.js +++ b/benchmark/es/string-concatenations.js @@ -19,14 +19,15 @@ const bench = common.createBenchmark(main, configs); function main(conf) { const n = +conf.n; - const mode = conf.mode; const str = 'abc'; const num = 123; let string; - switch (mode) { + switch (conf.mode) { + case '': + // Empty string falls through to next line as default, mostly for tests. case 'multi-concat': bench.start(); for (let i = 0; i < n; i++) @@ -63,6 +64,8 @@ function main(conf) { string = `${num}`; bench.end(n); break; + default: + throw new Error('Unexpected method'); } return string; diff --git a/benchmark/es/string-repeat.js b/benchmark/es/string-repeat.js index a6b389033a..1ddc7db78c 100644 --- a/benchmark/es/string-repeat.js +++ b/benchmark/es/string-repeat.js @@ -19,16 +19,23 @@ function main(conf) { let str; - if (conf.mode === 'Array') { - bench.start(); - for (let i = 0; i < n; i++) - str = new Array(size + 1).join(character); - bench.end(n); - } else { - bench.start(); - for (let i = 0; i < n; i++) - str = character.repeat(size); - bench.end(n); + switch (conf.mode) { + case '': + // Empty string falls through to next line as default, mostly for tests. + case 'Array': + bench.start(); + for (let i = 0; i < n; i++) + str = new Array(size + 1).join(character); + bench.end(n); + break; + case 'repeat': + bench.start(); + for (let i = 0; i < n; i++) + str = character.repeat(size); + bench.end(n); + break; + default: + throw new Error('Unexpected method'); } assert.strictEqual([...str].length, size); |