Parallel per-file JavaScript parsing for SpiderMonkey

Assigned to



5 years ago
4 years ago


(Reporter: seth, Assigned: seth)



Firefox Tracking Flags

(Not tracked)




5 years ago
I'd like to implement parallel per-file JavaScript parsing. By "per-file", I mean that we should get parallel speedup even when parsing a single file - this is distinct from (but builds upon) our current off-main-thread JavaScript parsing support.

In the past, I developed a working approach/algorithm intended to be used to parallelize existing parsers without too much work, and a research implementation which parallelizes a bison-based JavaScript parser and is capable of ~3x speedup with 4 threads. I believe this number can be further improved upon with some extensions I haven't implemented yet. However, some significant questions remain:

(1) How will the results end up looking with a more efficient underlying parsing algorithm? It's generally much easier to parallelize slow sequential code, and the bison-based parser I was using is slower than SpiderMonkey's parser by a factor of 2-3x.

(2) Can issues which are not dealt with in the research implementation (for example, string interning) be overcome efficiently?

(3) How do things change when the parallel parsing is happening on a busy system with other types of work happening on other threads?

I'll be able to make a more detailed proposal once I've been able to take some time to investigate these issues further.

At this stage, what I've done is hacked together a proof-of-concept that shows that parallel parsing can work in SpiderMonkey. This implementation works, but is not optimized and sidesteps several issues with hacks. It's not in a position yet where I can get useful performance numbers out of it, but it has convinced me that this task is feasible and that my approach seems applicable to SpiderMonkey.

My plan, if all goes well, is to begin actively working on this in the early part of 2014.

Comment 1

4 years ago
Is this still on radar?
You need to log in before you can comment on or make changes to this bug.