See #60399 (comment)
What happed to allocUnsafe - does that work at all in 24+?
Since 24.0.0, there is no observable perf difference between alloc and allocUnsafe on large arrays, and allocUnsafe always appears to be zero-filled
In that case places relying on allocUnsafe and then fill would be ~2x faster (or more) if they just used alloc instead of allocUnsafe in the first place
E.g. Buffer.concat([Buffer.alloc(0)], 1e6) is ~10x faster with .alloc instead of .allocUnsafe + .fill, and there appears to be no regression from that change on other Buffer.concat usage
allocUnsafe should be either fixed to be faster than alloc or should be replaced with alloc everywhere (that will simplify things) and deprecated whatsoever
See #60399 (comment)
What happed to
allocUnsafe- does that work at all in 24+?Since 24.0.0, there is no observable perf difference between
allocandallocUnsafeon large arrays, andallocUnsafealways appears to be zero-filledIn that case places relying on
allocUnsafeand thenfillwould be ~2x faster (or more) if they just usedallocinstead ofallocUnsafein the first placeE.g.
Buffer.concat([Buffer.alloc(0)], 1e6)is ~10x faster with.allocinstead of.allocUnsafe+.fill, and there appears to be no regression from that change on otherBuffer.concatusageallocUnsafeshould be either fixed to be faster thanallocor should be replaced withalloceverywhere (that will simplify things) and deprecated whatsoever