All the examples are optimized by Crankshaft. However, in the Float64Array
case, storing the intermediate values in the array forces a memory access.
When you use local variables, it's much faster, since the intermediate
double operations and local variables are stored in registers, avoiding
memory accesses and triggering only a single boxing operation at the
"return".

Danno

On Tue, Jan 17, 2012 at 2:01 AM, Joseph Gentle <[email protected]> wrote:

> I tried a simple test on jsperf to see if I can get a speedup from float64
> arrays:
>
> http://jsperf.com/float64-vs-float
>
> In this test, using float64 arrays end up slower than just using normal
> variables. JSPerf tests are only run for a few seconds - is that long
> enough for v8's optimizer to kick in properly? - Or is that benchmark
> correct, and I'm just missing something?
>
> -J
>
>
>
> On Friday, 30 December 2011 07:33:14 UTC+11, Vyacheslav Egorov wrote:
>>
>> 2) There are fields mutated in the loop that contain floating point
>> values. This currently requires boxing (and boxing requires heap
>> allocation, heap allocation puts pressure on GC etc). I wonder if you can
>> put typed arrays (e.g. Float64Array) to work here.
>>
>> --
>> Vyacheslav Egorov
>>
>>  --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
>

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

Reply via email to