Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d24e409

Browse filesBrowse files
addaleaxevanlucas
authored andcommitted
benchmark: add benchmark for Buffer.concat
PR-URL: #7054 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
1 parent e8c91e7 commit d24e409
Copy full SHA for d24e409

File tree

Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+26
-0
lines changed
Open diff view settings
Collapse file

‎benchmark/buffers/buffer-concat.js‎

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
const common = require('../common.js');
3+
4+
const bench = common.createBenchmark(main, {
5+
pieces: [1, 4, 16],
6+
pieceSize: [1, 16, 256],
7+
withTotalLength: [0, 1],
8+
n: [1024]
9+
});
10+
11+
function main(conf) {
12+
const n = +conf.n;
13+
const size = +conf.pieceSize;
14+
const pieces = +conf.pieces;
15+
16+
const list = new Array(pieces);
17+
list.fill(Buffer.allocUnsafe(size));
18+
19+
const totalLength = conf.withTotalLength ? pieces * size : undefined;
20+
21+
bench.start();
22+
for (var i = 0; i < n * 1024; i++) {
23+
Buffer.concat(list, totalLength);
24+
}
25+
bench.end(n);
26+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.