We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77325d5 commit 1bd62c7Copy full SHA for 1bd62c7
benchmark/buffers/buffer-concat.js
@@ -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