Open Bug 995537 Opened 11 years ago Updated 1 years ago

Consider discarding source for privileged scripts on Firefox Desktop

Categories

(Core :: XPConnect, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: bholley, Unassigned)

References

Details

(Whiteboard: [MemShrink:P2])

In bug 990353, I'm introducing a pref that lets us discard script source for privileged scripts. This saved around 4.3MB on b2g, which is significant. The basic premise is that, for script that we control, we can just choose not to make use of that feature. It's harder on Desktop, due to addons. _But_, with bug 990729, addon scripts will run in separate scopes. So once that lands, we can look into getting these memory savings on Desktop.
Whiteboard: [MemShrink]
(In reply to Bobby Holley (:bholley) from comment #0) > It's harder on Desktop, due to addons. _But_, with bug 990729, addon scripts > will run in separate scopes. So once that lands, we can look into getting > these memory savings on Desktop. ISTR some addons (popular ones) doing things like toSource on core browser code, search-and-replace, then re-evaling the result. So this is probably going to break things.
Whiteboard: [MemShrink] → [MemShrink:P2]
Addons are no longer a blocker for enabling javascript.options.discardSystemSource, but discarding system script sources is no longer a clear win, because it will disable lazy parsing, which saves something like 1MB per content process (bug 1303754).
Dumb question - can we do both, and discard after lazy parsing? Makes conceptual sense, but I don't know how much complexity it would entail.
That would certainly make sense, but I expect it would require work on the JS engine side. The effectiveness would also depend on how many chrome scripts we ever end up fully parsing. I don't know anything about this actually works.
We already discard the source for most chrome scripts. And unfortunately, we still also wind up doing lazy parsing and fetching the lazy source to do it... I've run into this when I've changed a local source file and restarted without purging the startip caches, and gotten weird syntax errors as a result. I'm pretty sure this causes startup crashes in the wild, too.
Oh, right, I thought I remembered something about you doing that, but then I saw that this pref was still set to false so I thought I was mistaken.
Severity: normal → S3
See Also: → 1505119
You need to log in before you can comment on or make changes to this bug.