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!

Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Drop of performance between FF31 and FF32 for matching a regexp

  • 1 réponse
  • 2 ont ce problème
  • 37 vues
  • Dernière réponse par cor-el

more options

Hello,

I'm trying to fix an addon on firefox 32 (sometime freezes the browser), I finally found the problem : it is a regexp execusion (with REGEXP.test(STRING) ).

For example, firstly load this page (I know it is a script) in FF31 : https://developer.cdn.mozilla.net/media/js/main-min.js?build=db5035d Display the developer tools and in the JS console copy/paste the following portion of code (I've simplified to a maximum to only let the problematic part of the regexp) :

test = "((\\S|\\s)+;\\s*\\n){10,}"; reg = new RegExp(test, "i"); reg.test(document.body.innerHTML)

The script terminates quickly (less than a second).

Do the same in FF32 : the brower becomes unresponsive and finally ask for stopping the execution of the script.

Could you help me understand why FF32 does not have the same behavior as FF31 ? Is there a workaround ?

Hello, I'm trying to fix an addon on firefox 32 (sometime freezes the browser), I finally found the problem : it is a regexp execusion (with REGEXP.test(STRING) ). For example, firstly load this page (I know it is a script) in FF31 : https://developer.cdn.mozilla.net/media/js/main-min.js?build=db5035d Display the developer tools and in the JS console copy/paste the following portion of code (I've simplified to a maximum to only let the problematic part of the regexp) : test = "((\\S|\\s)+;\\s*\\n){10,}"; reg = new RegExp(test, "i"); reg.test(document.body.innerHTML) The script terminates quickly (less than a second). Do the same in FF32 : the brower becomes unresponsive and finally ask for stopping the execution of the script. Could you help me understand why FF32 does not have the same behavior as FF31 ? Is there a workaround ?

Toutes les réponses (1)

more options

I can confirm that this happens with those STR. It fails when the result is false.

test = "((\\S|\\s)+;\\s*\\n){3,}"; reg = new RegExp(test, "i"); reg.test(document.body.innerHTML) -> true
test = "((\\S|\\s)+;\\s*\\n){4,}"; reg = new RegExp(test, "i"); reg.test(document.body.innerHTML) -> false

I see that you have filed a bug report about this.

  • bug 1070935 - Drop of performance between FF31 and FF32 when executing a regexp