Two arrays. Same million numbers, in the same order, with no gaps in either: const a = []; for (let i = 0; i < 1_000_000; i++) a.push(i); const b = new Array(1_000_000); for (let i = 0; i < 1_000_000; i++) b[i] = i; Copy each one with spread: [...a]: 0.17 ms [...b]: 0.71 ms Same contents, same length, and b takes four times as long to copy.... Weiterlesen: Packed vs Holey Arrays in V8: Why new Array(n) Makes Spread 4x Slower
Intelligence View
⚡ tsecurity.de Intelligence
Packed vs Holey Arrays in V8: Why new Array(n) Makes Spread 4x Slower
Two arrays. Same million numbers, in the same order, with no gaps in either: const a = []; for (let i = 0; i < 1_000_000; i++) a.push(i); const b = new…
Intelligence Digest gratis Dagelijks het belangrijkste beveiligingsnieuws · kan op elk moment worden opgehaald