Closed Bug 1058899 Opened 10 years ago Closed 7 years ago

Unnecessary XPIProviderUtils.js / extensions.json load at startup for profiles with only bootstrap add-ons

Categories

(Toolkit :: Add-ons Manager, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1358907
Performance Impact ?

People

(Reporter: Irving, Unassigned)

References

(Blocks 2 open bugs)

Details

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.
Whiteboard: [good first bug]
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.
Mentor: dtownsend
Whiteboard: [good first bug] → [good first bug][photon-performance][qf]
Flags: qe-verify?
Priority: -- → P2
Hey Mossop, how much would this affect the start-up time on Desktop for first-time profiles and pre-existing profiles?
Flags: needinfo?(dtownsend)
Whiteboard: [good first bug][photon-performance][qf] → [good first bug][photon-performance][qf:investigate]
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.
Flags: needinfo?(dtownsend)
We currently wind up loading it because telemetry queries the DB for existing add-ons during early startup (bug 1358907).
Priority: P2 → P3
Whiteboard: [good first bug][photon-performance][qf:investigate] → [good first bug][reserve-photon-performance][qf:investigate]
Flags: qe-verify? → qe-verify+
QA Contact: adrian.florinescu
Mentor: dtownsend → aswan
Assignee: nobody → jiangperry
Status: NEW → ASSIGNED
Priority: P3 → P1
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.
Assignee: jiangperry → nobody
Mentor: aswan
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Whiteboard: [good first bug][reserve-photon-performance][qf:investigate] → [reserve-photon-performance][qf:investigate]
Flags: qe-verify+
Priority: P1 → --
QA Contact: adrian.florinescu
Whiteboard: [reserve-photon-performance][qf:investigate] → [qf:investigate]
Performance Impact: --- → ?
Whiteboard: [qf:investigate]
You need to log in before you can comment on or make changes to this bug.