We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 415afe1 commit 8e7f4edCopy full SHA for 8e7f4ed
1 file changed
benchmark/buffers/buffer-copy.js
@@ -4,12 +4,13 @@ const common = require('../common.js');
4
const bench = common.createBenchmark(main, {
5
bytes: [8, 128, 1024],
6
partial: ['true', 'false'],
7
+ shared: ['true', 'false'],
8
n: [6e6],
9
});
10
-function main({ n, bytes, partial }) {
11
- const source = Buffer.allocUnsafe(bytes);
12
- const target = Buffer.allocUnsafe(bytes);
+function main({ n, bytes, partial, shared }) {
+ const source = shared ? Buffer.from(new SharedArrayBuffer(bytes)) : Buffer.allocUnsafe(bytes);
13
+ const target = shared ? Buffer.from(new SharedArrayBuffer(bytes)) : Buffer.allocUnsafe(bytes);
14
const sourceStart = (partial === 'true' ? Math.floor(bytes / 2) : 0);
15
bench.start();
16
for (let i = 0; i < n; i++) {
0 commit comments