-
-
Couldn't load subscription status.
- Fork 33.6k
Description
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