Skip to content

Commit 68bf482

Browse files
committed
fixup
1 parent 415afe1 commit 68bf482

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

benchmark/buffers/buffer-copy.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
bytes: [8, 128, 1024],
66
partial: ['true', 'false'],
7+
shared: ['true', 'false'],
78
n: [6e6],
89
});
910

10-
function main({ n, bytes, partial }) {
11-
const source = Buffer.allocUnsafe(bytes);
12-
const target = Buffer.allocUnsafe(bytes);
11+
function main({ n, bytes, partial, shared }) {
12+
const source = shared === 'true' ? Buffer.from(new SharedArrayBuffer(bytes)) : Buffer.allocUnsafe(bytes);
13+
const target = shared === 'true' ? Buffer.from(new SharedArrayBuffer(bytes)) : Buffer.allocUnsafe(bytes);
1314
const sourceStart = (partial === 'true' ? Math.floor(bytes / 2) : 0);
1415
bench.start();
1516
for (let i = 0; i < n; i++) {

0 commit comments

Comments
 (0)