parseInt() in Firefox significantly slower than Chrome's
Firefox: 0.0649999999998272ms Chrome: 0.005000000004656613ms
JS Fiddle: https://jsfiddle.net/2d1pjLu5/
Additional System Details
- User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Hi Jesse, this topic might be more appropriate for another forum:
But out of curiosity... I modified the last line of the script so that timings accumulate and you can compare multiple runs:
When I click Test 10 times, Firefox 57 gives me two initial outliers before it settles down (range of 0.010 to 0.055) (I didn't have an issue with the page freezing):
Took 0.05500000000029104ms Took 0.03999999999996362ms Took 0.015000000000327418ms Took 0.020000000000436557ms Took 0.014999999999417923ms Took 0.010000000000218279ms Took 0.010000000000218279ms Took 0.014999999999417923ms Took 0.015000000001236913ms Took 0.014999999999417923ms
Chrome 63 had a tighter range (0.010 to 0.025):
Took 0.020000000000436557ms Took 0.010000000000218279ms Took 0.014999999999417923ms Took 0.015000000000327418ms Took 0.019999999998617568ms Took 0.02500000000145519ms Took 0.024999999999636202ms Took 0.020000000000436557ms Took 0.019999999998617568ms Took 0.020000000000436557ms
I have to wonder whether the method of measurement might also be a factor, and how background processes in the browser come into play.
Of course, each subsequent set of 10 runs is different...