What version of Bun is running?
1.3.8
What platform is your computer?
x86_64-linux-gnu
What steps can reproduce the bug?
// Create string by concatenation (slow in Bun)
let s = '';
for (let i = 0; i < 100000; i++) s += 'A';
// Process characters with slice() - O(n²) in Bun
let m = new Map();
for (let i = 0; i < 100000; i++) {
let k = s.slice(i, i+1); // O(n) per operation in Bun
m.set(k, 1);
}
What is the expected behavior?
Expected (Node.js behavior): ~0.07s (O(n) linear time)
What do you see instead?
Actual (Bun 1.3.8): ~7.4s (O(n²) quadratic time)
Performance difference: 100x slower
Additional information
bug was discovered while debugging this benchmarks suite: https://kostya.github.io/LangArena/
What version of Bun is running?
1.3.8
What platform is your computer?
x86_64-linux-gnu
What steps can reproduce the bug?
// Create string by concatenation (slow in Bun)
let s = '';
for (let i = 0; i < 100000; i++) s += 'A';
// Process characters with slice() - O(n²) in Bun
let m = new Map();
for (let i = 0; i < 100000; i++) {
let k = s.slice(i, i+1); // O(n) per operation in Bun
m.set(k, 1);
}
What is the expected behavior?
Expected (Node.js behavior): ~0.07s (O(n) linear time)
What do you see instead?
Actual (Bun 1.3.8): ~7.4s (O(n²) quadratic time)
Performance difference: 100x slower
Additional information
bug was discovered while debugging this benchmarks suite: https://kostya.github.io/LangArena/