Closed Bug 1213676 Opened 10 years ago Closed 1 year ago

Lookahead regular expressions take significantly longer in web workers

Categories

(Core :: DOM: Workers, defect, P5)

All
Windows 7
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jmareda, Unassigned)

References

()

Details

(Keywords: perf, testcase, Whiteboard: dom-lws-bugdash-triage)

Attachments

(2 files)

I was trying to let a worker perform complex regular expressions to prevent blocking UI thread (regular expression execution is synchronous). Turns out that in worker, my expression with lookahead formula executes about three times longer. Since I was not ale to reproduce such a time difference in other browsers (including Firefox mobile) I assume this is Firefox desktop specific bug. [Demo](http://u8.8u.cz/testing/workers/) [Detailed description (StackOverflow)](http://stackoverflow.com/q/32910126/607407)
I am not sure, but I think the size of massage is relatively big in this case. (ref https://hacks.mozilla.org/2015/07/how-fast-are-web-workers/)
Keywords: perf
Nope, the size of message isn't big. And definitely does not significantly contribute to the delay.
Attached file testcase
I can reproduce on current Nightly on OS X. The inline version takes ~2s, while the same script in a web worker takes ~14s. The sample from the Activity Monitor seems to indicate the regexp JIT doesn't kick in for the worker (all the samples are in js::irregexp::InterpretCode), while for the inline script case the samples include what seems to be JITed code.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
Priority: -- → P5
Severity: normal → S3

Most likely we enabled jit on workers in the meantime?

Flags: needinfo?(bugmail)

A potentially scary thing is that the regex now takes much longer than 2 seconds on the main thread (the time listed in comment 5) but the profiler confirms that we end up in js::irregexp::Execute on both the main thread and in the worker and the samples beneath that are all unsymbolicated JIT, so the JIT is working.

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(bugmail)
Resolution: --- → WORKSFORME
Whiteboard: dom-lws-bugdash-triage
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: