parseInt() in Firefox significantly slower than Chrome's
Hello,
I have been doing some testing and have found the parseInt() javascript function is significantly slower in Firefox in comparison to Chrome. This is an issue as I am for looping strings and using this function to convert them to integers. In Chrome, it performs well, however in Firefox the page freezes for several seconds.
Firefox: 0.0649999999998272ms Chrome: 0.005000000004656613ms
JS Fiddle: https://jsfiddle.net/2d1pjLu5/
Cheers, Jesse
All Replies (1)
Hi Jesse, this topic might be more appropriate for another forum:
https://discourse.mozilla.org/c/firefox-development
But out of curiosity... I modified the last line of the script so that timings accumulate and you can compare multiple runs:
https://jsfiddle.net/2d1pjLu5/1/
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...