Closed
Bug 672064
Opened 13 years ago
Closed 13 years ago
twitter-text.js is slow to load in Firefox
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: sayrer, Unassigned)
References
Details
Attachments
(3 files)
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).
Reporter | ||
Comment 1•13 years ago
|
||
Reporter | ||
Comment 2•13 years ago
|
||
Reporter | ||
Updated•13 years ago
|
Attachment #546343 -
Attachment mime type: text/plain → application/x-javascript
Reporter | ||
Comment 3•13 years ago
|
||
Reporter | ||
Comment 4•13 years ago
|
||
Source repo is here:
https://github.com/twitter/twitter-text-js
Poking around twitter.com, 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•13 years ago
|
||
Reporter | ||
Comment 6•13 years ago
|
||
https://gist.github.com/1086653
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.
Reporter | ||
Comment 7•13 years ago
|
||
The issue was a really long regex. They fixed it on another branch by using character ranges instead.
https://github.com/twitter/twitter-text-js/commit/672cf1b17069712cb3a674c73f8a92b21669ac1b
Reporter | ||
Comment 8•13 years ago
|
||
Comment 9•13 years ago
|
||
673274
Comment 10•13 years ago
|
||
Making the dependency more specific. Note the reduction in bug 673188 comment 35.
Comment 11•13 years ago
|
||
HTML test case shows 9ms in nightlies for me.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in
before you can comment on or make changes to this bug.
Description
•