Use subscript loader to load browser.xul scripts

RESOLVED FIXED in Firefox 57

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: kmag, Assigned: kmag)

Tracking

(Blocks 1 bug)

unspecified
Firefox 57
Points:
---

Firefox Tracking Flags

(firefox57 fixed)

Details

(Whiteboard: [qf:p1])

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
There's a lot of overhead to loading scripts from <script> tags in browser.xul. They're loaded asynchronously, and can't begin loading until after we begin loading browser.xul. They're loaded using off-main-thread compilation, which means we need to create and merge a new JS zone for each script we load that way. They don't benefit from the startup cache at all.

If we load those scripts using the subscript loader, they're loaded from the preloader cache, and begin loading as early as possible. And they're all loaded into a single off-thread zone, which means there are less zones to create and merge. From a quick test, this seems to save about 20-40ms on Windows ts_paint talos runs.

The main downside is that subscript loader scripts don't benefit from lazy parsing, so we might wind up increasing memory usage if most of the functions in those scripts aren't used very often. But we should hopefully be able to fix that by migrating more browser JS to lazy loading.
See Also: → 1381853
Comment hidden (mozreview-request)
Whiteboard: [qf] → [qf:p1]

Comment 2

2 years ago
mozreview-review
Comment on attachment 8890539 [details]
Bug 1384714: Use subscript loader to load browser.xul scripts.

https://reviewboard.mozilla.org/r/161676/#review167598
Attachment #8890539 - Flags: review?(dtownsend) → review+
ping, should we land this?
Flags: needinfo?(kmaglione+bmo)
(Assignee)

Comment 4

2 years ago
I'll land. I just decided to wait until after the merge, and it's ended up in my backlog in the mean time.
Flags: needinfo?(kmaglione+bmo)

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/b80466887686
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
I see a perf improvement:
== Change summary for alert #9098 (as of August 26 2017 19:16 UTC) ==

Improvements:

  5%  tart summary windows10-64 opt e10s     6.17 -> 5.84

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=9098
You need to log in before you can comment on or make changes to this bug.