summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-08-13 17:51:58 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-09-07 19:58:36 +0200
commitde33a5aa6ea357fb7c6fde7b75a024e16be88a47 (patch)
treeace9ed29d50ddccff99395f8eadaa7e617ca972b /benchmark
parentaf2e5f95227506d08485cc2464ee1df9784eb726 (diff)
downloadandroid-node-v8-de33a5aa6ea357fb7c6fde7b75a024e16be88a47.tar.gz
android-node-v8-de33a5aa6ea357fb7c6fde7b75a024e16be88a47.tar.bz2
android-node-v8-de33a5aa6ea357fb7c6fde7b75a024e16be88a47.zip
benchmark: refactor util benchmarks
This significantly reduces the benchmark runtime. It removes to many variations that do not provide any benefit and reduces the iterations. PR-URL: https://github.com/nodejs/node/pull/22503 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/util/format.js2
-rw-r--r--benchmark/util/inspect-array.js4
-rw-r--r--benchmark/util/inspect-proxy.js2
-rw-r--r--benchmark/util/inspect.js4
-rw-r--r--benchmark/util/normalize-encoding.js29
-rw-r--r--benchmark/util/priority-queue.js2
-rw-r--r--benchmark/util/splice-one.js2
-rw-r--r--benchmark/util/type-check.js2
8 files changed, 18 insertions, 29 deletions
diff --git a/benchmark/util/format.js b/benchmark/util/format.js
index 042b8a93cc..2a4a20097c 100644
--- a/benchmark/util/format.js
+++ b/benchmark/util/format.js
@@ -16,7 +16,7 @@ const inputs = {
};
const bench = common.createBenchmark(main, {
- n: [4e6],
+ n: [1e5],
type: Object.keys(inputs)
});
diff --git a/benchmark/util/inspect-array.js b/benchmark/util/inspect-array.js
index 8b3c54aeb9..4fd73785f7 100644
--- a/benchmark/util/inspect-array.js
+++ b/benchmark/util/inspect-array.js
@@ -4,8 +4,8 @@ const common = require('../common');
const util = require('util');
const bench = common.createBenchmark(main, {
- n: [1e3],
- len: [1e5],
+ n: [5e2],
+ len: [1e2, 1e5],
type: [
'denseArray',
'sparseArray',
diff --git a/benchmark/util/inspect-proxy.js b/benchmark/util/inspect-proxy.js
index 5427df9952..3c82d50ac3 100644
--- a/benchmark/util/inspect-proxy.js
+++ b/benchmark/util/inspect-proxy.js
@@ -3,7 +3,7 @@
const util = require('util');
const common = require('../common.js');
-const bench = common.createBenchmark(main, { n: [1e6] });
+const bench = common.createBenchmark(main, { n: [2e4] });
function main({ n }) {
const proxyA = new Proxy({}, { get: () => {} });
diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js
index 35253ac966..9ba3020fd0 100644
--- a/benchmark/util/inspect.js
+++ b/benchmark/util/inspect.js
@@ -9,7 +9,7 @@ const opts = {
none: undefined
};
const bench = common.createBenchmark(main, {
- n: [2e6],
+ n: [2e4],
method: [
'Object',
'Object_empty',
@@ -81,7 +81,7 @@ function main({ method, n, option }) {
benchmark(n, new Error('error'), options);
break;
case 'Array':
- benchmark(n, Array(20).fill().map((_, i) => i), options);
+ benchmark(n, Array(50).fill().map((_, i) => i), options);
break;
case 'TypedArray':
obj = new Uint8Array(Array(50).fill().map((_, i) => i));
diff --git a/benchmark/util/normalize-encoding.js b/benchmark/util/normalize-encoding.js
index 73cbadff72..47c8bce277 100644
--- a/benchmark/util/normalize-encoding.js
+++ b/benchmark/util/normalize-encoding.js
@@ -5,26 +5,23 @@ const assert = require('assert');
const groupedInputs = {
group_common: ['undefined', 'utf8', 'utf-8', 'base64',
- 'binary', 'latin1', 'ucs-2'],
- group_upper: ['UTF-8', 'UTF8', 'UCS2', 'UTF-16LE',
- 'UTF16LE', 'BASE64', 'UCS-2'],
- group_uncommon: ['foo', '1', 'false', 'undefined', '[]', '{}'],
+ 'binary', 'latin1', 'ucs2'],
+ group_upper: ['UTF-8', 'UTF8', 'UCS2',
+ 'UTF16LE', 'BASE64', 'UCS2'],
+ group_uncommon: ['foo'],
group_misc: ['', 'utf16le', 'hex', 'HEX', 'BINARY']
};
const inputs = [
- '',
- 'utf8', 'utf-8', 'UTF-8',
- 'UTF8', 'Utf8', 'uTf-8', 'utF-8',
- 'ucs2', 'UCS2', 'UcS2',
- 'ucs-2', 'UCS-2', 'UcS-2',
- 'utf16le', 'utf-16le', 'UTF-16LE', 'UTF16LE',
+ '', 'utf8', 'utf-8', 'UTF-8', 'UTF8', 'Utf8',
+ 'ucs2', 'UCS2', 'utf16le', 'UTF16LE',
'binary', 'BINARY', 'latin1', 'base64', 'BASE64',
- 'hex', 'HEX', 'foo', '1', 'false', 'undefined', '[]', '{}'];
+ 'hex', 'HEX', 'foo', 'undefined'
+];
const bench = common.createBenchmark(main, {
input: inputs.concat(Object.keys(groupedInputs)),
- n: [1e7]
+ n: [1e5]
}, {
flags: '--expose-internals'
});
@@ -39,16 +36,8 @@ function getInput(input) {
return groupedInputs.group_uncommon;
case 'group_misc':
return groupedInputs.group_misc;
- case '1':
- return [1];
- case 'false':
- return [false];
case 'undefined':
return [undefined];
- case '[]':
- return [[]];
- case '{}':
- return [{}];
default:
return [input];
}
diff --git a/benchmark/util/priority-queue.js b/benchmark/util/priority-queue.js
index 51a696439a..9cff7cbbac 100644
--- a/benchmark/util/priority-queue.js
+++ b/benchmark/util/priority-queue.js
@@ -3,7 +3,7 @@
const common = require('../common');
const bench = common.createBenchmark(main, {
- n: [1e6]
+ n: [1e5]
}, { flags: ['--expose-internals'] });
function main({ n, type }) {
diff --git a/benchmark/util/splice-one.js b/benchmark/util/splice-one.js
index 5c2a39f6d7..4ca7c8564d 100644
--- a/benchmark/util/splice-one.js
+++ b/benchmark/util/splice-one.js
@@ -3,7 +3,7 @@
const common = require('../common');
const bench = common.createBenchmark(main, {
- n: [1e7],
+ n: [1e5],
pos: ['start', 'middle', 'end'],
size: [10, 100, 500],
}, { flags: ['--expose-internals'] });
diff --git a/benchmark/util/type-check.js b/benchmark/util/type-check.js
index d9ba7bc209..d9acdaedf5 100644
--- a/benchmark/util/type-check.js
+++ b/benchmark/util/type-check.js
@@ -29,7 +29,7 @@ const bench = common.createBenchmark(main, {
type: Object.keys(args),
version: ['native', 'js'],
argument: ['true', 'false-primitive', 'false-object'],
- n: [5e6]
+ n: [1e5]
}, {
flags: ['--expose-internals']
});