Thank you Jakob. You are right indeed. I updated the code to use regular JS 
arrays [1], and garbage has gone:

V8:
> time ./d8 ./nbody_js_arrays.js -- 50000000 
-0.169075164
-0.169059907
./d8 ./nbody_js_arrays.js -- 50000000  *24.93s* user 0.06s system 99% cpu 
25.061 total

SpiderMonkey suffers with this approach though:
> time ./js ./nbody_js_arrays.js 50000000
-0.169075164
-0.169059907
./js ./nbody_js_arrays.js 50000000  *35.07s* user 0.09s system 98% cpu 
35.817 total

I guess my best bet would be to wait and see what's coming :).

Cheers,
Andrei

[1] https://gist.github.com/anvaka/5447630

On Tuesday, April 23, 2013 1:27:14 AM UTC-7, Jakob Kummerow wrote:
>
> One more clarification: to avoid allocation of HeapNumbers (and therefore 
> GC) in existing V8 versions, it's not necessary to re-write the app using 
> Float64Arrays -- just using regular JavaScript Arrays is enough (e.g.: 
> "this.position = [x, y, z];"). As long as there are only numbers in the 
> array, V8 will detect this and store the numbers in unboxed form.
>
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to