const COUNT1 = 1024;
const COUNT2 = 10240;
const COUNT3 = 102400;
function encrypt(buf, value = 199)
{
let count = Math.min(buf.length, COUNT1);
for (let i = 0; i < count; i++)
buf[i] += value;
count = Math.min(buf.length, COUNT2);
for (let i = COUNT1; i < count; i += 2)
buf[i] += value;
count = Math.min(buf.length, COUNT3);
for (let i = COUNT2; i < count; i += 4)
buf[i] += value;
}
const buf = Buffer.alloc(100000);
function aa()
{
console.time("j");
for (let i = 0; i < 100000; i++)
encrypt(buf, 199);
console.timeEnd("j");
}
for (let index = 0; index < 10; index++) {
aa()
}
Tried running the same on Ubuntu 22.04.4, I have the same time (~2.5s) for both. (bun version 1.1.3). Did you try running it multiple times ? Maybe you were just unlucky.
What version of Bun is running?
1.1.3
What platform is your computer?
Microsoft Windows NT 10.0.19044.0 x64 (win10)
What steps can reproduce the bug?
What is the expected behavior?
nodejs:2.044s bunjs : 8.01s
What do you see instead?
No response
Additional information
No response