Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove benchmark
  • Loading branch information
seishun committed May 5, 2020
commit 621eb2358a54521bbd5f96ef4b9db338e367acab
8 changes: 3 additions & 5 deletions benchmark/buffers/buffer-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
bytes: [0, 8, 128, 32 * 1024],
partial: ['true', 'false'],
oob: ['true', 'false'],
n: [6e6]
});

function main({ n, bytes, partial, oob }) {
function main({ n, bytes, partial }) {
const source = Buffer.allocUnsafe(bytes);
const target = Buffer.allocUnsafe(bytes * 2);
const target = Buffer.allocUnsafe(bytes);
const sourceStart = (partial === 'true' ? Math.floor(bytes / 2) : 0);
const sourceEnd = (oob === 'true' ? source.length + 1 : source.length);
bench.start();
for (let i = 0; i < n; i++) {
source.copy(target, 0, sourceStart, sourceEnd);
source.copy(target, 0, sourceStart);
}
bench.end(n);
}