Re:JavaScript Array.push is 945x faster than Array.concat
by skohan on Thursday May 23, 2019 @11:39AM
(#19992724)
Is this really done? It seems like this approach would require all arrays to be allocated with at least a page's worth of memory, which seems incredibly wasteful if you have a bunch of small arrays with a handful of floats or something.
[ Parent
| on HN ]
Re:JavaScript Array.push is 945x faster than Array.concat
by Someone on Thursday May 23, 2019 @02:37PM
(#19994553)
”It seems like this approach would require all arrays to be allocated with at least a page's worth of memory”
I don’t know whether it is done in practice, but you can postpone doing that until the array gets ‘big’, for some definition of ‘big’.