Closed Bug 900292 Opened 11 years ago Closed 10 years ago

Enable lazy parsing for self-hosting JS

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: till, Assigned: till)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

On my machine, JSRuntime::initSelfHosting takes about 9ms. When I remove all the PJS-related code, that goes down to 6ms. Additionally removing the Intl-related code makes that 1.9ms. So enabling Intl adds 4.1ms.

Given that Talos runs on hardware that is quite a bit slower, I guess the 4.1ms translate to maybe 8ms or 10ms in Ts. Enabling lazy parsing for self-hosted JS should enable us to claim back a good part of that.
This almost works. It causes some weird test failures still, which I have to track down.

However, it doesn't really do anything for the time spent under JSRuntime::initSelfHosting. Without Intl, the duration is basically flat. With Intl, it goes down by ~1ms: from ~6ms to ~5ms.

I'm not sure I understand why that is: with PJS (which uses destructuring a lot, so will cause full parsing for most functions) removed, all but five fairly small functions get compiled lazily (measured by printf-ing at the ends of the two `finishFunctionDefinition` functions).

All in all, lazily parsing the self-hosting code might not be worth it. Or I'm just doing something wrong with my measurements.
Assignee: general → till
Status: NEW → ASSIGNED
Is the syntax parser getting disabled at some point?  I.e. is FullParseHandler::disableSyntaxParser ever called?
(In reply to Brian Hackett (:bhackett) from comment #2)
> Is the syntax parser getting disabled at some point?  I.e. is
> FullParseHandler::disableSyntaxParser ever called?

It was, before I changed the `let` in Utilities.js:90 to a `var`. But it's not called for the runs I measured.
Blocks: 916021
Blocks: 941783
Till: do we still want lazy parsing of self-hosted JS? Now that we fork B2G content processes using Nuwa, does JSRuntime::initSelfHosting() time matter much?
Flags: needinfo?(till)
Keywords: perf
Yeah, not only don't we want it anymore: it's outright impossible. The self-hosting compartment is shared per-process and must be read-only after startup, so all parsing has to have happened at that point.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: needinfo?(till)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: