Closed Bug 1384714 Opened 7 years ago Closed 7 years ago

Use subscript loader to load browser.xul scripts

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 57
Performance Impact high
Tracking Status
firefox57 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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
Whiteboard: [qf] → [qf:p1]
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)
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)
https://hg.mozilla.org/mozilla-central/rev/b80466887686
Status: NEW → RESOLVED
Closed: 7 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
Performance Impact: --- → P1
Whiteboard: [qf:p1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: