Tuesday, October 25, 2011

Re: Array Performance

I forgot to mention the for loop invariant.

By test results are according to

var times = document.getElementById("times").value;
//Began capturing time
for(i=0; i < times; ++i)
{
...
}

I have converted it to

var times = parseInt(document.getElementById("times").value);
//Began capturing time
for(i=0; i < times; ++i)
{
...
}


So the results are:


My results are a bit strange.
1 million times
(Chrome 14 results)
JS X-Y: mgpoint1 : 645
JS Array: mgpoint2 : 718
Proto X-Y: mgpoint3 : 37
Proto Array: mgpoint4 : 56
Optimized X-Y: mgpoint5 : 23
GWT X-Y: MGPoint2 : 31
GWT Array: MGPoint : 2461

1 million times
(Firefox 5 results)
JS X-Y: mgpoint1 : 414
JS Array: mgpoint2 : 576
Proto X-Y: mgpoint3 : 120
Proto Array: mgpoint4 : 204
Optimized X-Y: mgpoint5: 114
GWT X-Y: MGPoint2 : 137
GWT Array: MGPoint : 4014


-XdisableCastChecking resulted with no change.


On Oct 25, 1:09 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> Compile in -style PRETTY to see how GWT compiles your Java code down to JS.
> There won't be getX/getY (they'll be inlined), at least in the x,y case (and
> if there are, they'll be "staticified": getX(point) instead of
> point.getX()). And you'll probably see type coercion/checking in the array
> case (and if that's the case, as I suspect, it's what causes the difference
> in performance between your two implementations).

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment