Near the end of XPIProvider startup, we check if we have any add-ons installed and, if so, we try to make sure there is an extensions.ini file (around http://hg.mozilla.org/mozilla-central/annotate/e30f862fe19e/toolkit/mozapps/extensions/internal/XPIProvider.jsm#l3519). In the case where all XPIs are bootstrap add-ons, XPIDatabase.writeAddonsList() ends up not creating an extensions.ini file, so this check ends up triggering on every startup. XPIDatabase.writeAddonsList() does a synchronous load of the XPI database (XPIProviderUtils.js and extensions.json) if it isn't already loaded, so it adds significant start-up time. Telemetry for one day (20140822) shows about 14% of Fennec start-ups triggering the synchronous DB load in XPIDatabase.writeAddonsList(). This only rarely affects desktop, because there is almost always an extensions.ini to load the default theme. Fixing this could overlap with bug 1049142, so I'd suggest waiting for that to land.
Bug 1049142 is now FIXED. Wouldn't a possible fix (or hack, if you wish) be making sure that XPIDatabase.writeAddonsList() always returns with an extensions.ini, possibly an empty one if only bootstrapped add-ons are present? BTW, comment #0 says this shouldn't affect desktop, which needs an extensions.ini for its default theme; Thunderbird has a default theme too; SeaMonkey has Default, Modern, ChatZilla, DOM Inspector and the Debug & QA UI; so what _is_ affected? Fennec? FxOS?
(In reply to Tony Mechelynck [:tonymec] from comment #1) > Bug 1049142 is now FIXED. > > Wouldn't a possible fix (or hack, if you wish) be making sure that > XPIDatabase.writeAddonsList() always returns with an extensions.ini, > possibly an empty one if only bootstrapped add-ons are present? > > BTW, comment #0 says this shouldn't affect desktop, which needs an > extensions.ini for its default theme; Thunderbird has a default theme too; > SeaMonkey has Default, Modern, ChatZilla, DOM Inspector and the Debug & QA > UI; so what _is_ affected? Fennec? FxOS? Fennec is affected. We originally made it so we didn't have an extensions.ini file in the case where it was necessary because it caused a performance hit to load it that was most noticeable on low-end android devices.
Hey Mossop, how much would this affect the start-up time on Desktop for first-time profiles and pre-existing profiles?
This is worth re-investigating given bug 1358846, much of this has been changed there. Notably we will no longer have prefs and JSON files and the INI file - just a JSON file. We're also eliminating dir scanning generally, although this is easier for some install locations and add-on types than others.
(In reply to Mike Conley (:mconley) - PTO on April 28th. from comment #3) > Hey Mossop, how much would this affect the start-up time on Desktop for > first-time profiles and pre-existing profiles? We shouldn't be loading XPIProviderUtils.js or extensions.json at all for pre-existing profiles unless there has been some change to the add-ons or some add-on demands it. If that is happening then there is a bug.
We currently wind up loading it because telemetry queries the DB for existing add-ons during early startup (bug 1358907).
The scenario from the original bug report is now quite obsolete. As Kris mentions in comment 6, we're still loading the database during startup but we have an existing bug covering that, marking this as a duplcate of that bug.