GeezerVison is showing github.com — benchmark: refactor util benchmarks · nodejs/node@90bbab6
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/util/format.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ const inputs = { | 16 | 16 | }; | 17 | 17 |
| 18 | 18 | const bench = common.createBenchmark(main, { | 19 | | - n: [4e6], | | 19 | + n: [1e5], | 20 | 20 | type: Object.keys(inputs) | 21 | 21 | }); | 22 | 22 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/inspect-array.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,8 +4,8 @@ const common = require('../common'); | 4 | 4 | const util = require('util'); | 5 | 5 |
| 6 | 6 | const bench = common.createBenchmark(main, { | 7 | | - n: [1e3], | 8 | | - len: [1e5], | | 7 | + n: [5e2], | | 8 | + len: [1e2, 1e5], | 9 | 9 | type: [ | 10 | 10 | 'denseArray', | 11 | 11 | 'sparseArray', | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/inspect-proxy.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | const util = require('util'); | 4 | 4 | const common = require('../common.js'); | 5 | 5 |
| 6 | | -const bench = common.createBenchmark(main, { n: [1e6] }); | | 6 | +const bench = common.createBenchmark(main, { n: [2e4] }); | 7 | 7 |
| 8 | 8 | function main({ n }) { | 9 | 9 | const proxyA = new Proxy({}, { get: () => {} }); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/inspect.js +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ const opts = { | 9 | 9 | none: undefined | 10 | 10 | }; | 11 | 11 | const bench = common.createBenchmark(main, { | 12 | | - n: [2e6], | | 12 | + n: [2e4], | 13 | 13 | method: [ | 14 | 14 | 'Object', | 15 | 15 | 'Object_empty', | @@ -81,7 +81,7 @@ function main({ method, n, option }) { | 81 | 81 | benchmark(n, new Error('error'), options); | 82 | 82 | break; | 83 | 83 | case 'Array': | 84 | | - benchmark(n, Array(20).fill().map((_, i) => i), options); | | 84 | + benchmark(n, Array(50).fill().map((_, i) => i), options); | 85 | 85 | break; | 86 | 86 | case 'TypedArray': | 87 | 87 | obj = new Uint8Array(Array(50).fill().map((_, i) => i)); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/normalize-encoding.js +9-20Lines changed: 9 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,26 +5,23 @@ const assert = require('assert'); | 5 | 5 |
| 6 | 6 | const groupedInputs = { | 7 | 7 | group_common: ['undefined', 'utf8', 'utf-8', 'base64', | 8 | | - 'binary', 'latin1', 'ucs-2'], | 9 | | - group_upper: ['UTF-8', 'UTF8', 'UCS2', 'UTF-16LE', | 10 | | - 'UTF16LE', 'BASE64', 'UCS-2'], | 11 | | - group_uncommon: ['foo', '1', 'false', 'undefined', '[]', '{}'], | | 8 | + 'binary', 'latin1', 'ucs2'], | | 9 | + group_upper: ['UTF-8', 'UTF8', 'UCS2', | | 10 | + 'UTF16LE', 'BASE64', 'UCS2'], | | 11 | + group_uncommon: ['foo'], | 12 | 12 | group_misc: ['', 'utf16le', 'hex', 'HEX', 'BINARY'] | 13 | 13 | }; | 14 | 14 |
| 15 | 15 | const inputs = [ | 16 | | - '', | 17 | | - 'utf8', 'utf-8', 'UTF-8', | 18 | | - 'UTF8', 'Utf8', 'uTf-8', 'utF-8', | 19 | | - 'ucs2', 'UCS2', 'UcS2', | 20 | | - 'ucs-2', 'UCS-2', 'UcS-2', | 21 | | - 'utf16le', 'utf-16le', 'UTF-16LE', 'UTF16LE', | | 16 | + '', 'utf8', 'utf-8', 'UTF-8', 'UTF8', 'Utf8', | | 17 | + 'ucs2', 'UCS2', 'utf16le', 'UTF16LE', | 22 | 18 | 'binary', 'BINARY', 'latin1', 'base64', 'BASE64', | 23 | | - 'hex', 'HEX', 'foo', '1', 'false', 'undefined', '[]', '{}']; | | 19 | + 'hex', 'HEX', 'foo', 'undefined' | | 20 | +]; | 24 | 21 |
| 25 | 22 | const bench = common.createBenchmark(main, { | 26 | 23 | input: inputs.concat(Object.keys(groupedInputs)), | 27 | | - n: [1e7] | | 24 | + n: [1e5] | 28 | 25 | }, { | 29 | 26 | flags: '--expose-internals' | 30 | 27 | }); | @@ -39,16 +36,8 @@ function getInput(input) { | 39 | 36 | return groupedInputs.group_uncommon; | 40 | 37 | case 'group_misc': | 41 | 38 | return groupedInputs.group_misc; | 42 | | - case '1': | 43 | | - return [1]; | 44 | | - case 'false': | 45 | | - return [false]; | 46 | 39 | case 'undefined': | 47 | 40 | return [undefined]; | 48 | | - case '[]': | 49 | | - return [[]]; | 50 | | - case '{}': | 51 | | - return [{}]; | 52 | 41 | default: | 53 | 42 | return [input]; | 54 | 43 | } | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/splice-one.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | const common = require('../common'); | 4 | 4 |
| 5 | 5 | const bench = common.createBenchmark(main, { | 6 | | - n: [1e7], | | 6 | + n: [1e5], | 7 | 7 | pos: ['start', 'middle', 'end'], | 8 | 8 | size: [10, 100, 500], | 9 | 9 | }, { flags: ['--expose-internals'] }); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/util/type-check.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,7 +29,7 @@ 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 | | - n: [5e6] | | 32 | + n: [1e5] | 33 | 33 | }, { | 34 | 34 | flags: ['--expose-internals'] | 35 | 35 | }); | |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-benchmark-util.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,5 +13,6 @@ runBenchmark('util', | 13 | 13 | 'pos=start', | 14 | 14 | 'size=1', | 15 | 15 | 'type=', | | 16 | + 'len=1', | 16 | 17 | 'version=native'], | 17 | 18 | { NODEJS_BENCHMARK_ZERO_ALLOWED: 1 }); |
|