$ .post jQuery faster or slower depending on browser?

I am trying to improve jQuery's performance, and I noticed that it works faster in Chrome than in other browsers. Does it make sense when it's just an AJAX call to a PHP file?

To test this, I do this in the 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:

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

Can development tools for accessing the console in each browser interfere with these results?

Thanks.

+7
source share
1 answer

I think if:

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

you will see the same difference. These are probably just different javascript parsers.

0
source

All Articles