[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Firefox 6x faster than Chrome for cross-product

Simon Blackwell

3/22/2016 11:13:00 PM

We have tested 5 different cross-product algorithms at http://jsperf.com/cros....

Firefox and Chrome are reasonably similar for 4 out of the 5, but in one Firefox is 6x faster than Chrome. Given that one of the stress tests for our application generates over 1,000,000 possible combinations, this performance difference is very meaningful.

I would like to know three things:

1) What, if anything, are we doing to kill Chrome optimization on the recursive algorithm that is so much better in Firefox?

2) Is anyone aware of faster algorithms than those we have tested?

3) Is there a place to formally advise the v8 team regarding this issue. We have to port to Node.js, and our app will run slower on the server than in a Firefox browser!
2 Answers

Cezary Tomczyk

3/23/2016 12:28:00 AM

0

On 22/03/2016 23:13, Simon Blackwell wrote:
> We have tested 5 different cross-product algorithms at
> http://jsperf.com/cros....
>
> Firefox and Chrome are reasonably similar for 4 out of the 5, but in
> one Firefox is 6x faster than Chrome. Given that one of the stress
> tests for our application generates over 1,000,000 possible
> combinations, this performance difference is very meaningful.

Perhaps better to test not a 1,000,000 possible combinations, but
something close to reality. I strongly suppose that in reality how
Chrome and Firefox in that particular case has no impact on overall
application performance.

> I would like to know three things:
>
> 1) What, if anything, are we doing to kill Chrome optimization on the
> recursive algorithm that is so much better in Firefox?

I strongly suppose this is applicable only for some corner cases where
you have really millions of operations. I wouldn't worry about that as I
consider this as a premature optimization.

> 2) Is anyone aware of faster algorithms than those we have tested?

Try to test on few combinations and compare the results. Not a millions.
Then you'll get the results more closer to the reality.

> 3) Is there a place to formally advise the v8 team regarding this
> issue. We have to port to Node.js, and our app will run slower on the
> server than in a Firefox browser!

https://bugs.chromium.org/p/v8/i...

--
Cezary Tomczyk
http://www.ct...

Simon Blackwell

3/30/2016 8:54:00 AM

0

On Tuesday, March 22, 2016 at 8:27:52 PM UTC-4, Cezary Tomczyk wrote:
> On 22/03/2016 23:13, Simon Blackwell wrote:
> > We have tested 5 different cross-product algorithms at
> > http://jsperf.com/cros....
> >
> > Firefox and Chrome are reasonably similar for 4 out of the 5, but in
> > one Firefox is 6x faster than Chrome. Given that one of the stress
> > tests for our application generates over 1,000,000 possible
> > combinations, this performance difference is very meaningful.
>
> Perhaps better to test not a 1,000,000 possible combinations, but
> something close to reality. I strongly suppose that in reality how
> Chrome and Firefox in that particular case has no impact on overall
> application performance.
>
> > I would like to know three things:
> >
> > 1) What, if anything, are we doing to kill Chrome optimization on the
> > recursive algorithm that is so much better in Firefox?
>
> I strongly suppose this is applicable only for some corner cases where
> you have really millions of operations. I wouldn't worry about that as I
> consider this as a premature optimization.
>
> > 2) Is anyone aware of faster algorithms than those we have tested?
>
> Try to test on few combinations and compare the results. Not a millions.
> Then you'll get the results more closer to the reality.
>
> > 3) Is there a place to formally advise the v8 team regarding this
> > issue. We have to port to Node.js, and our app will run slower on the
> > server than in a Firefox browser!
>
> https://bugs.chromium.org/p/v8/i...
>
> --
> Cezary Tomczyk
> http://www.ct...

Thanks Tom. Granted for some 1,000,000 is an edge case ... but in the world of big data ... for some that's just getting started! We poked around some more and discovered that replacing

var row = arrays.map(function(array,index) {
return array[indices[index]];
});

with the below fixed the issue and makes Chrome substantially faster.

var row = new Array(arrays.length);
for(var i=0;i<arrays.length;i++) {
var array = arrays[i];
row[i] = array[indices[i]];
}