Question

I'm trying to improve my jQuery performance and I've noticed it runs faster in Chrome than in other browsers. Does it make sense when it is just an AJAX call to a PHP file?

In order to test it, I am doing this on a click event:

var startTime = new Date();

$.post("http://"+ document.domain + "action.json",  { data:  data}, 
    function(dat){

        console.log('ending:  ', (new Date() - startTime) / 1000);
    }
});

Result in seconds are:

  • Chrome 25: 0.148
  • Firefox 19.0.2: 0.212
  • Internet Explorer 9: 0.272
  • Opera 12.14: 0.219

Can the development tools to access the console on each browser interfere in this results?

Thanks.

Was it helpful?

Solution

I think if you do:

var startTime = new Date();

var a=0;

for(i=0;i<50000;i++){
    a++;
}
console.log('ending:  ', (new Date() - startTime) / 1000);

you will see same difference. Probably it just different javascript parsers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top