Status: New
Owner: ----

New issue 2392 by [email protected]: Array: big performance difference when creating big array from empty or single-element array
http://code.google.com/p/v8/issues/detail?id=2392

Tested with ia32 and x64 builds of the current bleeding_edge HEAD, r12842. The numbers posted here are from the x64 build. The ia32 numbers are comparable albeit slightly better.

$ cat tmp/big-array/1.js
for (var a = [], i = 0; i < 64*1024*1024; ++i) a.push(123.456);

$ time out/native/d8 tmp/big-array/1.js
real 0m3.672s
user 0m3.176s
sys 0m0.452s

$ cat tmp/big-array/2.js
for (var a = [123.456], i = 0; i < 64*1024*1024; ++i) a.push(123.456);

$ time out/native/d8 tmp/big-array/2.js
#
# Fatal error in CALL_AND_RETRY_0
# Allocation failed - process out of memory
#

Trace/breakpoint trap (core dumped)

real 0m52.356s
user 0m51.995s
sys 0m0.416s

As a gist: https://gist.github.com/4009799

It's not all bad, though. Array concatenation is fast, impressively so.

$ cat tmp/big-array/3.js
for (var a = [123.456], i = 0; i < 26; ++i) a = a.concat(a);

$ time out/native/d8 tmp/big-array/3.js
real    0m1.664s
user    0m1.468s
sys     0m0.192s

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to