Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 672064 - twitter-text.js is slow to load in Firefox
: twitter-text.js is slow to load in Firefox
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: 8 Branch
: x86 Mac OS X
: -- normal with 1 vote (vote)
: mozilla10
Assigned To: general
: Jason Orendorff [:jorendorff]
Depends on: 673188
Blocks: WebJSPerf
  Show dependency treegraph
Reported: 2011-07-16 11:55 PDT by Robert Sayre
Modified: 2011-10-18 21:35 PDT (History)
12 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

jquery dependency (160.01 KB, application/x-javascript)
2011-07-16 11:57 PDT, Robert Sayre
no flags Details
twitter-text.js (28.21 KB, application/x-javascript)
2011-07-16 11:58 PDT, Robert Sayre
no flags Details
Test case (521 bytes, text/html)
2011-07-16 12:00 PDT, Robert Sayre
no flags Details

Description Robert Sayre 2011-07-16 11:55:09 PDT
I was playing around with this file this morning and noticed that the latency was really bad in Firefox 5 and 8. I narrowed it down to the time need to create a bunch of regular expressions. Will attach a testcase. Here are the times:

Firefox 8:      1450ms
WebKit Nightly: 150ms
Chrome 12:      20ms

Since we're sharing a regex implementation with WebKit, I am puzzled by the disparity here. Perhaps we are eagerly compiling each regex and they are doing so lazily. I ruled out network traffic by placing timers directly in the source (attached test is different, so as not to perturb the original file).
Comment 1 Robert Sayre 2011-07-16 11:57:30 PDT
Created attachment 546343 [details]
jquery dependency
Comment 2 Robert Sayre 2011-07-16 11:58:27 PDT
Created attachment 546344 [details]
Comment 3 Robert Sayre 2011-07-16 12:00:50 PDT
Created attachment 546345 [details]
Test case
Comment 4 Robert Sayre 2011-07-16 12:05:52 PDT
Source repo is here:

Poking around, I see that this file does get used, albeit an earlier version with fewer regexes to run. 

(Also CCing oliver@apple in case he wants to file a bug on JSC being an order of magnitude slower than V8 here)
Comment 5 Oliver Hunt 2011-07-16 12:11:44 PDT
Comment 6 Robert Sayre 2011-07-16 12:20:17 PDT

Here's a patch that speeds up the load in all browsers, in the WebKit bug Oliver points out that I didn't Shark it yet so it could be something else.
Comment 7 Robert Sayre 2011-07-16 16:44:26 PDT
The issue was a really long regex. They fixed it on another branch by using character ranges instead.
Comment 9 Timothy Nikkel (:tnikkel) 2011-07-21 15:56:51 PDT
Comment 10 Chris Leary [:cdleary] (not checking bugmail) 2011-10-07 15:47:37 PDT
Making the dependency more specific. Note the reduction in bug 673188 comment 35.
Comment 11 Chris Leary [:cdleary] (not checking bugmail) 2011-10-18 21:35:58 PDT
HTML test case shows 9ms in nightlies for me.

Note You need to log in before you can comment on or make changes to this bug.