Last Comment Bug 617136 - Investigate RegExp slowness on Peacekeeper snippet
: Investigate RegExp slowness on Peacekeeper snippet
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: x86_64 Linux
-- normal (vote)
: ---
Assigned To: Chris Leary [:cdleary] (not checking bugmail)
: Jason Orendorff [:jorendorff]
Depends on:
Blocks: peacekeeper 551624
  Show dependency treegraph
Reported: 2010-12-06 14:15 PST by Chris Leary [:cdleary] (not checking bugmail)
Modified: 2012-01-15 11:00 PST (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image Chris Leary [:cdleary] (not checking bugmail) 2010-12-06 14:15:12 PST
Jandem pointed out this example, derived from Dromaeo.

function f(ua) {
    var x = 0;
    var t0 = new Date;
    for(var i=0; i<10000000; i++) {
	//var ua1 = ua + i;
	if (/Windows/.exec(ua)) 
    alert(new Date - t0);
    return x;
f("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)");

<jandem> bz: when i change exec to test... FF4: 3600 ms, latest webkit nightly: 2200 ms, opera 980 ms...
Comment 1 User image Jan de Mooij [:jandem] 2010-12-07 09:58:45 PST
Not Dromaeo but Peacekeeper. stringDetectBrowser test (see But I think it's a general regexp problem, so it affects Dromaeo too.
Comment 2 User image Steve Fink [:sfink] [:s:] 2011-10-17 11:28:19 PDT
Isn't this one fixed now?
Comment 3 User image Boris Zbarsky [:bz] (still a bit busy) 2011-10-17 11:34:17 PDT
Seems to be in the sense that exec() and test() do equally fast (or slowly?) on the testcase from comment 0 in latest nightly.

We're faster than Chrome there, but slower than Opera....
Comment 4 User image Chris Leary [:cdleary] (not checking bugmail) 2011-10-17 11:42:21 PDT
That sounds fixed to me (by Brian's bug to elide object creation in the regexp literal exec case). Reopen if there are objections.

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