Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-04 03:34:00 +0300
committerRich Trott <rtrott@gmail.com>2019-06-20 21:55:50 +0300
commit7b802685c4980addb51de8f6854de71dce8493f3 (patch)
tree85be26bfea0c69360f2e793b8037dad4a1fe87d8 /benchmark
parent5ccce52113a0f01da474eb066ac40d2dcbea1a55 (diff)
benchmark: refactor buffer benchmarks
Currently the buffer benchmarks take significantly too long to complete. This drastically reduces the overall runtime by removing obsolete checked variations and reducing the iteration count. It also improves the benchmarks by removing the deprecated `new Buffer(size)` usage and some other small improvements. PR-URL: https://github.com/nodejs/node/pull/26418 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Peter Marshall <petermarshall@chromium.org> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/buffers/buffer-bytelength.js4
-rw-r--r--benchmark/buffers/buffer-compare-instance-method.js20
-rw-r--r--benchmark/buffers/buffer-compare-offset.js2
-rw-r--r--benchmark/buffers/buffer-compare.js2
-rw-r--r--benchmark/buffers/buffer-concat.js10
-rw-r--r--benchmark/buffers/buffer-creation.js18
-rw-r--r--benchmark/buffers/buffer-fill.js2
-rw-r--r--benchmark/buffers/buffer-from.js25
-rw-r--r--benchmark/buffers/buffer-hex.js4
-rw-r--r--benchmark/buffers/buffer-indexof-number.js6
-rw-r--r--benchmark/buffers/buffer-indexof.js8
-rw-r--r--benchmark/buffers/buffer-iterate.js13
-rw-r--r--benchmark/buffers/buffer-normalize-encoding.js5
-rw-r--r--benchmark/buffers/buffer-read-float.js2
-rw-r--r--benchmark/buffers/buffer-read-with-byteLength.js7
-rw-r--r--benchmark/buffers/buffer-read.js11
-rw-r--r--benchmark/buffers/buffer-slice.js4
-rw-r--r--benchmark/buffers/buffer-swap.js4
-rw-r--r--benchmark/buffers/buffer-tojson.js2
-rw-r--r--benchmark/buffers/buffer-tostring.js8
-rw-r--r--benchmark/buffers/buffer-write-string.js17
-rw-r--r--benchmark/buffers/buffer-write.js7
-rw-r--r--benchmark/buffers/buffer-zero.js4
23 files changed, 80 insertions, 105 deletions
diff --git a/benchmark/buffers/buffer-bytelength.js b/benchmark/buffers/buffer-bytelength.js
index 4caad301445..90d43ec7f02 100644
--- a/benchmark/buffers/buffer-bytelength.js
+++ b/benchmark/buffers/buffer-bytelength.js
@@ -3,8 +3,8 @@ const common = require('../common');
const bench = common.createBenchmark(main, {
encoding: ['utf8', 'base64', 'buffer'],
- len: [1, 2, 4, 16, 64, 256], // x16
- n: [5e6]
+ len: [2, 16, 256], // x16
+ n: [4e6]
});
// 16 chars each
diff --git a/benchmark/buffers/buffer-compare-instance-method.js b/benchmark/buffers/buffer-compare-instance-method.js
index 77a3e84fa70..284001c236d 100644
--- a/benchmark/buffers/buffer-compare-instance-method.js
+++ b/benchmark/buffers/buffer-compare-instance-method.js
@@ -2,8 +2,8 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- size: [16, 512, 1024, 4096, 16386],
- args: [1, 2, 3, 4, 5],
+ size: [16, 512, 4096, 16386],
+ args: [1, 2, 5],
n: [1e6]
});
@@ -19,22 +19,6 @@ function main({ n, size, args }) {
switch (args) {
case 2:
b0.compare(b1, 0);
- break;
- case 3:
- b0.compare(b1, 0, b1Len);
- break;
- case 4:
- b0.compare(b1, 0, b1Len, 0);
- break;
- case 5:
- b0.compare(b1, 0, b1Len, 0, b0Len);
- break;
- default:
- b0.compare(b1);
- }
- switch (args) {
- case 2:
- b0.compare(b1, 0);
bench.start();
for (i = 0; i < n; i++) {
b0.compare(b1, 0);
diff --git a/benchmark/buffers/buffer-compare-offset.js b/benchmark/buffers/buffer-compare-offset.js
index 89cc4427d9a..d08a3124423 100644
--- a/benchmark/buffers/buffer-compare-offset.js
+++ b/benchmark/buffers/buffer-compare-offset.js
@@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
method: ['offset', 'slice'],
- size: [16, 512, 1024, 4096, 16386],
+ size: [16, 512, 4096, 16386],
n: [1e6]
});
diff --git a/benchmark/buffers/buffer-compare.js b/benchmark/buffers/buffer-compare.js
index cb4f0f475c9..e6cf850da68 100644
--- a/benchmark/buffers/buffer-compare.js
+++ b/benchmark/buffers/buffer-compare.js
@@ -23,7 +23,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- size: [16, 512, 1024, 4096, 16386],
+ size: [16, 512, 4096, 16386],
n: [1e6]
});
diff --git a/benchmark/buffers/buffer-concat.js b/benchmark/buffers/buffer-concat.js
index 3f9cffc06a6..ced0f4ff31c 100644
--- a/benchmark/buffers/buffer-concat.js
+++ b/benchmark/buffers/buffer-concat.js
@@ -2,20 +2,20 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- pieces: [1, 4, 16],
+ pieces: [4, 16],
pieceSize: [1, 16, 256],
withTotalLength: [0, 1],
- n: [1024]
+ n: [8e5]
});
function main({ n, pieces, pieceSize, withTotalLength }) {
- const list = new Array(pieces);
- list.fill(Buffer.allocUnsafe(pieceSize));
+ const list = Array.from({ length: pieces })
+ .fill(Buffer.allocUnsafe(pieceSize));
const totalLength = withTotalLength ? pieces * pieceSize : undefined;
bench.start();
- for (var i = 0; i < n * 1024; i++) {
+ for (var i = 0; i < n; i++) {
Buffer.concat(list, totalLength);
}
bench.end(n);
diff --git a/benchmark/buffers/buffer-creation.js b/benchmark/buffers/buffer-creation.js
index a7b340131eb..38d80da915c 100644
--- a/benchmark/buffers/buffer-creation.js
+++ b/benchmark/buffers/buffer-creation.js
@@ -1,5 +1,4 @@
'use strict';
-const SlowBuffer = require('buffer').SlowBuffer;
const common = require('../common.js');
const assert = require('assert');
@@ -9,10 +8,9 @@ const bench = common.createBenchmark(main, {
'fast-alloc-fill',
'fast-allocUnsafe',
'slow-allocUnsafe',
- 'slow',
- 'buffer()'],
- len: [10, 1024, 2048, 4096, 8192],
- n: [1024]
+ ],
+ len: [10, 1024, 4096, 8192],
+ n: [6e5]
});
function main({ len, n, type }) {
@@ -24,7 +22,7 @@ function main({ len, n, type }) {
break;
case 'fast-alloc-fill':
bench.start();
- for (i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.alloc(len, 0);
}
bench.end(n);
@@ -35,18 +33,12 @@ function main({ len, n, type }) {
case 'slow-allocUnsafe':
fn = Buffer.allocUnsafeSlow;
break;
- case 'slow':
- fn = SlowBuffer;
- break;
- case 'buffer()':
- fn = Buffer;
- break;
default:
assert.fail('Should not get here');
}
bench.start();
- for (i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
fn(len);
}
bench.end(n);
diff --git a/benchmark/buffers/buffer-fill.js b/benchmark/buffers/buffer-fill.js
index b497597fa13..02bc2a206c6 100644
--- a/benchmark/buffers/buffer-fill.js
+++ b/benchmark/buffers/buffer-fill.js
@@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
'fill("t", 0)',
'fill(Buffer.alloc(1), 0)',
],
- size: [2 ** 8, 2 ** 13, 2 ** 16],
+ size: [2 ** 13, 2 ** 16],
n: [2e4]
});
diff --git a/benchmark/buffers/buffer-from.js b/benchmark/buffers/buffer-from.js
index 437bf930f9f..1df1b5b362f 100644
--- a/benchmark/buffers/buffer-from.js
+++ b/benchmark/buffers/buffer-from.js
@@ -8,14 +8,13 @@ const bench = common.createBenchmark(main, {
'arraybuffer',
'arraybuffer-middle',
'buffer',
- 'uint8array',
'string',
'string-utf8',
'string-base64',
'object',
],
- len: [10, 2048],
- n: [2048]
+ len: [100, 2048],
+ n: [8e5]
});
function main({ len, n, source }) {
@@ -26,17 +25,19 @@ function main({ len, n, source }) {
const uint8array = new Uint8Array(len);
const obj = { length: null }; // Results in a new, empty Buffer
+ let i = 0;
+
switch (source) {
case 'array':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(array);
}
bench.end(n);
break;
case 'arraybuffer':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(arrayBuf);
}
bench.end(n);
@@ -45,49 +46,49 @@ function main({ len, n, source }) {
const offset = ~~(len / 4);
const length = ~~(len / 2);
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(arrayBuf, offset, length);
}
bench.end(n);
break;
case 'buffer':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(buffer);
}
bench.end(n);
break;
case 'uint8array':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(uint8array);
}
bench.end(n);
break;
case 'string':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(str);
}
bench.end(n);
break;
case 'string-utf8':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(str, 'utf8');
}
bench.end(n);
break;
case 'string-base64':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(str, 'base64');
}
bench.end(n);
break;
case 'object':
bench.start();
- for (let i = 0; i < n * 1024; i++) {
+ for (i = 0; i < n; i++) {
Buffer.from(obj);
}
bench.end(n);
diff --git a/benchmark/buffers/buffer-hex.js b/benchmark/buffers/buffer-hex.js
index 4d87313961a..1b49ca74538 100644
--- a/benchmark/buffers/buffer-hex.js
+++ b/benchmark/buffers/buffer-hex.js
@@ -3,8 +3,8 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- len: [0, 1, 64, 1024],
- n: [1e7]
+ len: [64, 1024],
+ n: [1e6]
});
function main({ len, n }) {
diff --git a/benchmark/buffers/buffer-indexof-number.js b/benchmark/buffers/buffer-indexof-number.js
index 91bff0d54bb..bd3fe34f4d7 100644
--- a/benchmark/buffers/buffer-indexof-number.js
+++ b/benchmark/buffers/buffer-indexof-number.js
@@ -5,7 +5,7 @@ const path = require('path');
const bench = common.createBenchmark(main, {
value: ['@'.charCodeAt(0)],
- n: [1e7]
+ n: [1e6]
});
function main({ n, value }) {
@@ -13,9 +13,11 @@ function main({ n, value }) {
path.resolve(__dirname, '../fixtures/alice.html')
);
+ let count = 0;
bench.start();
for (var i = 0; i < n; i++) {
- aliceBuffer.indexOf(value, 0, undefined);
+ count += aliceBuffer.indexOf(value, 0, undefined);
}
bench.end(n);
+ return count;
}
diff --git a/benchmark/buffers/buffer-indexof.js b/benchmark/buffers/buffer-indexof.js
index f3b9dcf1fac..cd083e85793 100644
--- a/benchmark/buffers/buffer-indexof.js
+++ b/benchmark/buffers/buffer-indexof.js
@@ -6,16 +6,12 @@ const path = require('path');
const searchStrings = [
'@',
'SQ',
- '10x',
'--l',
'Alice',
'Gryphon',
- 'Panther',
'Ou est ma chatte?',
'found it very',
- 'among mad people',
'neighbouring pool',
- 'Soo--oop',
'aaaaaaaaaaaaaaaaa',
'venture to go near the house till she had brought herself down to',
'</i> to the Caterpillar',
@@ -23,9 +19,9 @@ const searchStrings = [
const bench = common.createBenchmark(main, {
search: searchStrings,
- encoding: ['undefined', 'utf8', 'ucs2', 'binary'],
+ encoding: ['utf8', 'ucs2'],
type: ['buffer', 'string'],
- n: [100000]
+ n: [5e4]
});
function main({ n, search, encoding, type }) {
diff --git a/benchmark/buffers/buffer-iterate.js b/benchmark/buffers/buffer-iterate.js
index 7a275b0bcb8..e81ce2b3035 100644
--- a/benchmark/buffers/buffer-iterate.js
+++ b/benchmark/buffers/buffer-iterate.js
@@ -4,8 +4,8 @@ const common = require('../common.js');
const assert = require('assert');
const bench = common.createBenchmark(main, {
- size: [16, 512, 1024, 4096, 16386],
- type: ['fast', 'slow'],
+ size: [512, 4096, 16386],
+ type: ['fast'],
method: ['for', 'forOf', 'iterator'],
n: [1e3]
});
@@ -17,9 +17,10 @@ const methods = {
};
function main({ size, type, method, n }) {
- const clazz = type === 'fast' ? Buffer : SlowBuffer;
- const buffer = new clazz(size);
- buffer.fill(0);
+ const buffer = type === 'fast' ?
+ Buffer.alloc(size) :
+ SlowBuffer(size).fill(0);
+
const fn = methods[method || 'for'];
bench.start();
@@ -46,7 +47,7 @@ function benchForOf(buffer, n) {
function benchIterator(buffer, n) {
for (var k = 0; k < n; k++) {
const iter = buffer[Symbol.iterator]();
- var cur = iter.next();
+ let cur = iter.next();
while (!cur.done) {
assert(cur.value === 0);
diff --git a/benchmark/buffers/buffer-normalize-encoding.js b/benchmark/buffers/buffer-normalize-encoding.js
index e33f7e0bc2a..1c743c83712 100644
--- a/benchmark/buffers/buffer-normalize-encoding.js
+++ b/benchmark/buffers/buffer-normalize-encoding.js
@@ -5,23 +5,18 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
encoding: [
'ascii',
- 'ASCII',
'base64',
'BASE64',
'binary',
- 'BINARY',
'hex',
'HEX',
'latin1',
'LATIN1',
- 'ucs-2',
'UCS-2',
- 'ucs2',
'UCS2',
'utf-16le',
'UTF-16LE',
'utf-8',
- 'UTF-8',
'utf16le',
'UTF16LE',
'utf8',
diff --git a/benchmark/buffers/buffer-read-float.js b/benchmark/buffers/buffer-read-float.js
index dbccf57393f..7589fbfc334 100644
--- a/benchmark/buffers/buffer-read-float.js
+++ b/benchmark/buffers/buffer-read-float.js
@@ -3,7 +3,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
type: ['Double', 'Float'],
- endian: ['BE', 'LE'],
+ endian: ['LE'],
value: ['zero', 'big', 'small', 'inf', 'nan'],
n: [1e6]
});
diff --git a/benchmark/buffers/buffer-read-with-byteLength.js b/benchmark/buffers/buffer-read-with-byteLength.js
index 65d5f8f01ee..aea6344a82e 100644
--- a/benchmark/buffers/buffer-read-with-byteLength.js
+++ b/benchmark/buffers/buffer-read-with-byteLength.js
@@ -9,15 +9,16 @@ const types = [
];
const bench = common.createBenchmark(main, {
- buffer: ['fast', 'slow'],
+ buffer: ['fast'],
type: types,
n: [1e6],
byteLength: [1, 2, 3, 4, 5, 6]
});
function main({ n, buf, type, byteLength }) {
- const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
- const buff = new clazz(8);
+ const buff = buf === 'fast' ?
+ Buffer.alloc(8) :
+ require('buffer').SlowBuffer(8);
const fn = `read${type || 'IntBE'}`;
buff.writeDoubleLE(0, 0);
diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js
index 06e2c6c70eb..d407475ae4e 100644
--- a/benchmark/buffers/buffer-read.js
+++ b/benchmark/buffers/buffer-read.js
@@ -16,21 +16,18 @@ const types = [
'Int16BE',
'Int32LE',
'Int32BE',
- 'FloatLE',
- 'FloatBE',
- 'DoubleLE',
- 'DoubleBE',
];
const bench = common.createBenchmark(main, {
- buffer: ['fast', 'slow'],
+ buffer: ['fast'],
type: types,
n: [1e6]
});
function main({ n, buf, type }) {
- const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
- const buff = new clazz(8);
+ const buff = buf === 'fast' ?
+ Buffer.alloc(8) :
+ require('buffer').SlowBuffer(8);
const fn = `read${type || 'UInt8'}`;
buff.writeDoubleLE(0, 0);
diff --git a/benchmark/buffers/buffer-slice.js b/benchmark/buffers/buffer-slice.js
index 2e52475da91..82c960d5601 100644
--- a/benchmark/buffers/buffer-slice.js
+++ b/benchmark/buffers/buffer-slice.js
@@ -4,7 +4,7 @@ const SlowBuffer = require('buffer').SlowBuffer;
const bench = common.createBenchmark(main, {
type: ['fast', 'slow'],
- n: [1024]
+ n: [1e6]
});
const buf = Buffer.allocUnsafe(1024);
@@ -13,7 +13,7 @@ const slowBuf = new SlowBuffer(1024);
function main({ n, type }) {
const b = type === 'fast' ? buf : slowBuf;
bench.start();
- for (var i = 0; i < n * 1024; i++) {
+ for (var i = 0; i < n; i++) {
b.slice(10, 256);
}
bench.end(n);
diff --git a/benchmark/buffers/buffer-swap.js b/benchmark/buffers/buffer-swap.js
index a85bcf32307..0d3897ad892 100644
--- a/benchmark/buffers/buffer-swap.js
+++ b/benchmark/buffers/buffer-swap.js
@@ -5,8 +5,8 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
aligned: ['true', 'false'],
method: ['swap16', 'swap32', 'swap64'/* , 'htons', 'htonl', 'htonll' */],
- len: [8, 64, 128, 256, 512, 768, 1024, 1536, 2056, 4096, 8192],
- n: [5e7]
+ len: [64, 256, 768, 1024, 2056, 8192],
+ n: [1e6]
});
// The htons and htonl methods below are used to benchmark the
diff --git a/benchmark/buffers/buffer-tojson.js b/benchmark/buffers/buffer-tojson.js
index 71936fb622e..d01a93ab5ed 100644
--- a/benchmark/buffers/buffer-tojson.js
+++ b/benchmark/buffers/buffer-tojson.js
@@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1e4],
- len: [0, 10, 256, 4 * 1024]
+ len: [0, 256, 4 * 1024]
});
function main({ n, len }) {
diff --git a/benchmark/buffers/buffer-tostring.js b/benchmark/buffers/buffer-tostring.js
index b2a14d8aec5..88543d8fd3a 100644
--- a/benchmark/buffers/buffer-tostring.js
+++ b/benchmark/buffers/buffer-tostring.js
@@ -3,10 +3,10 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- encoding: ['', 'utf8', 'ascii', 'latin1', 'binary', 'hex', 'UCS-2'],
- args: [0, 1, 2, 3],
- len: [0, 1, 64, 1024],
- n: [1e7]
+ encoding: ['utf8', 'ascii', 'latin1', 'hex', 'UCS-2'],
+ args: [0, 1, 3],
+ len: [1, 64, 1024],
+ n: [1e6]
});
function main({ encoding, args, len, n }) {
diff --git a/benchmark/buffers/buffer-write-string.js b/benchmark/buffers/buffer-write-string.js
index 6bd98ba4af9..b30edcf8867 100644
--- a/benchmark/buffers/buffer-write-string.js
+++ b/benchmark/buffers/buffer-write-string.js
@@ -3,36 +3,40 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
encoding: [
- '', 'utf8', 'ascii', 'hex', 'UCS-2', 'utf16le', 'latin1', 'binary',
+ '', 'utf8', 'ascii', 'hex', 'utf16le', 'latin1',
],
args: [ '', 'offset', 'offset+length' ],
- len: [10, 2048],
- n: [1e7]
+ len: [2048],
+ n: [1e6]
});
function main({ len, n, encoding, args }) {
- const string = 'a'.repeat(len);
+ let string;
+ let start = 0;
const buf = Buffer.allocUnsafe(len);
var i;
switch (args) {
case 'offset':
+ string = 'a'.repeat(Math.floor(len / 2));
+ start = len - string.length;
if (encoding) {
bench.start();
for (i = 0; i < n; ++i) {
- buf.write(string, 0, encoding);
+ buf.write(string, start, encoding);
}
bench.end(n);
} else {
bench.start();
for (i = 0; i < n; ++i) {
- buf.write(string, 0);
+ buf.write(string, start);
}
bench.end(n);
}
break;
case 'offset+length':
+ string = 'a'.repeat(len);
if (encoding) {
bench.start();
for (i = 0; i < n; ++i) {
@@ -48,6 +52,7 @@ function main({ len, n, encoding, args }) {
}
break;
default:
+ string = 'a'.repeat(len);
if (encoding) {
bench.start();
for (i = 0; i < n; ++i) {
diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js
index be5a6adc8ea..02c0752feaf 100644
--- a/benchmark/buffers/buffer-write.js
+++ b/benchmark/buffers/buffer-write.js
@@ -27,7 +27,7 @@ const types = [
];
const bench = common.createBenchmark(main, {
- buffer: ['fast', 'slow'],
+ buffer: ['fast'],
type: types,
n: [1e6]
});
@@ -71,8 +71,9 @@ const byteLength = {
};
function main({ n, buf, type }) {
- const clazz = buf === 'fast' ? Buffer : require('buffer').SlowBuffer;
- const buff = new clazz(8);
+ const buff = buf === 'fast' ?
+ Buffer.alloc(8) :
+ require('buffer').SlowBuffer(8);
const fn = `write${type || 'UInt8'}`;
if (!/\d/.test(fn))
diff --git a/benchmark/buffers/buffer-zero.js b/benchmark/buffers/buffer-zero.js
index 1263732dce8..09792f038af 100644
--- a/benchmark/buffers/buffer-zero.js
+++ b/benchmark/buffers/buffer-zero.js
@@ -3,7 +3,7 @@
const common = require('../common.js');
const bench = common.createBenchmark(main, {
- n: [1024],
+ n: [1e6],
type: ['buffer', 'string']
});
@@ -14,6 +14,6 @@ function main({ n, type }) {
const data = type === 'buffer' ? zeroBuffer : zeroString;
bench.start();
- for (var i = 0; i < n * 1024; i++) Buffer.from(data);
+ for (var i = 0; i < n; i++) Buffer.from(data);
bench.end(n);
}