Open Bug 392650 Opened 17 years ago Updated 2 years ago

nsXULPrototypeCache should coalesce simultaneous script loads

Categories

(Core :: XUL, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

Details

(Keywords: memory-footprint, perf)

nsXULPrototypeCache should maintain a table of currently loading scripts that are going to go into the cache so that we don't load the same script twice, from two different documents. We currently waste time doing this at Firefox startup on Mac, for 5 different scripts used from both browser.xul and hiddenWindow.xul. See bug 392542 for the details. What we should do is: * have a table in nsXULPrototypeCache of currently loading scripts * If useCache is true in nsXULDocument::LoadScript, we should, instead of instantiating a stream loader directly, tell the prototype cache to load the script. (We want this a bit after the GetScript call because we still need to block.) * when the prototype cache gets the notification from the stream loader that the load is complete, it notifies the first of the documents loading the script to compile the script (probably just OnStreamComplete) and gives the rest (at least if the compilation succeeded) a different notification so that they get the script out of the cache and unblock themselves. * remove the patch from bug 392542 and replace it with the assertion in bug 392542 comment 0. This is both a performance and footprint issue because we currently compile the script twice (extra work, although hopefully not too much with fastload) and keep both copies around (one for the first of the racing windows that loaded it, the other for the cache and all other windows, including the later of the racing windows).
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Blocks: fx-noise
You can now set DEBUG_BUG_392650 to enable a warning for duplicate script loads.
No longer blocks: fx-noise
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.