We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

ఇంకా తెలుసుకోండి

parseInt() in Firefox significantly slower than Chrome's

  • 1 ప్రత్యుత్తరం
  • 1 ఈ సమస్య కలిగినది
  • 2 వీక్షణలు
  • చివరి సమాధానమిచ్చినది jscher2000 - Support Volunteer

more options

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

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

ప్రత్యుత్తరాలన్నీ (1)

more options

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...