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).
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)
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.
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
6 years ago
Making the dependency more specific. Note the reduction in bug 673188 comment 35.
HTML test case shows 9ms in nightlies for me.