diff options
author | Sarah Meyer <sarahsaltrick@gmail.com> | 2017-10-06 12:58:55 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-10-28 13:56:44 -0700 |
commit | 50fe1a840915a22517ffd2c480558409dbfd6677 (patch) | |
tree | bfca585a19d684368acd49141248ec7c20f06446 /benchmark/util/type-check.js | |
parent | 64aded33ef310ca87e5566239ab2dbd12b1899b9 (diff) | |
download | android-node-v8-50fe1a840915a22517ffd2c480558409dbfd6677.tar.gz android-node-v8-50fe1a840915a22517ffd2c480558409dbfd6677.tar.bz2 android-node-v8-50fe1a840915a22517ffd2c480558409dbfd6677.zip |
tools, benchmark: test util benchmark
Create a minimal test for the util benchmark files.
PR-URL: https://github.com/nodejs/node/pull/16050
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'benchmark/util/type-check.js')
-rw-r--r-- | benchmark/util/type-check.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/benchmark/util/type-check.js b/benchmark/util/type-check.js index 1d9a4f30ef..ee8dd7e4ec 100644 --- a/benchmark/util/type-check.js +++ b/benchmark/util/type-check.js @@ -29,16 +29,19 @@ const bench = common.createBenchmark(main, { type: Object.keys(args), version: ['native', 'js'], argument: ['true', 'false-primitive', 'false-object'], - millions: ['5'] + n: [5e6] }, { flags: ['--expose-internals'] }); function main(conf) { + // For testing, if supplied with an empty type, default to ArrayBufferView. + conf.type = conf.type || 'ArrayBufferView'; + const util = process.binding('util'); const types = require('internal/util/types'); - const n = (+conf.millions * 1e6) | 0; + const n = (+conf.n) | 0; const func = { native: util, js: types }[conf.version][`is${conf.type}`]; const arg = args[conf.type][conf.argument]; |