| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 64aded3 commit 50fe1a8
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,9 @@ const bench = common.createBenchmark(main, { | |||
| 21 | 21 | }); | |
| 22 | 22 | ||
| 23 | 23 | function main({ n, type }) { | |
| 24 | + // For testing, if supplied with an empty type, default to string. | ||
| 25 | + type = type || 'string'; | ||
| 26 | + | ||
| 24 | 27 | const [first, second] = inputs[type]; | |
| 25 | 28 | ||
| 26 | 29 | bench.start(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,9 @@ function main({ n, len, type }) { | |||
| 18 | 18 | var arr = Array(len); | |
| 19 | 19 | var i, opts; | |
| 20 | 20 | ||
| 21 | + // For testing, if supplied with an empty type, default to denseArray. | ||
| 22 | + type = type || 'denseArray'; | ||
| 23 | + | ||
| 21 | 24 | switch (type) { | |
| 22 | 25 | case 'denseArray_showHidden': | |
| 23 | 26 | opts = { showHidden: true }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,16 +29,19 @@ const bench = common.createBenchmark(main, { | |||
| 29 | 29 | type: Object.keys(args), | |
| 30 | 30 | version: ['native', 'js'], | |
| 31 | 31 | argument: ['true', 'false-primitive', 'false-object'], | |
| 32 | - millions: ['5'] | ||
| 32 | + n: [5e6] | ||
| 33 | 33 | }, { | |
| 34 | 34 | flags: ['--expose-internals'] | |
| 35 | 35 | }); | |
| 36 | 36 | ||
| 37 | 37 | function main(conf) { | |
| 38 | + // For testing, if supplied with an empty type, default to ArrayBufferView. | ||
| 39 | + conf.type = conf.type || 'ArrayBufferView'; | ||
| 40 | + | ||
| 38 | 41 | const util = process.binding('util'); | |
| 39 | 42 | const types = require('internal/util/types'); | |
| 40 | 43 | ||
| 41 | - const n = (+conf.millions * 1e6) | 0; | ||
| 44 | + const n = (+conf.n) | 0; | ||
| 42 | 45 | const func = { native: util, js: types }[conf.version][`is${conf.type}`]; | |
| 43 | 46 | const arg = args[conf.type][conf.argument]; | |
| 44 | 47 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + | ||
| 5 | + const runBenchmark = require('../common/benchmark'); | ||
| 6 | + | ||
| 7 | + runBenchmark('util', | ||
| 8 | + ['argument=false', | ||
| 9 | + 'input=', | ||
| 10 | + 'method=Array', | ||
| 11 | + 'n=1', | ||
| 12 | + 'option=none', | ||
| 13 | + 'type=', | ||
| 14 | + 'version=native']); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments