Comment

Comment by DXA9zE

There is nothing wrong with using new Array() to construct array of known capacity. By default, I think JS literal arrays will have a capacity of 4, so especially if you know you will have less than four elements, or a non power of two number of elements, this can be seen as a micro-optimization. `bluebird` uses new Array() extensively, e.g.

https://github.com/petkaantonov/bluebird/blob/12154adb501660...

parent DXA9zE 6 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton