Closed Bug 1358648 Opened 4 years ago Closed 4 years ago

Weave.js is expensive during early startup due to importing resource://services-sync/util.js

Categories

(Firefox :: Sync, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Firefox 55
Iteration:
55.5 - May 15
Tracking Status
firefox55 --- fixed

People

(Reporter: florian, Assigned: eoger)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [photon-performance])

Attachments

(3 files)

About 4% of the time before the first browser window is shown is spent in http://searchfox.org/mozilla-central/source/services/sync/Weave.js and almost all of the time spent there is importing resource://services-sync/util.js

I think this should be a lazy getter.

Here it is on a Mac startup profile: https://perfht.ml/2pNYWEq
Equivalent Windows profile: https://perfht.ml/2pO7v1W
Actually, Promise.jsm is visible in the profile too, so it would be nice to stop using it there and use a native promise instead.

FileUtils.jsm should also become a lazy getter... or maybe even better import it right before its only use in the file.
Flags: qe-verify?
Priority: -- → P2
There's a good chance that bug 1353571 will fix this.
(In reply to Mark Hammond [:markh] from comment #2)
> There's a good chance that bug 1353571 will fix this.

Ok, the current patches there don't seem to touch the Weave.js file, but as long as it gets fixed, I don't really care in which bug we do it :-).
Depends on: 1353571
Duplicate of this bug: 1361437
Wish I could have done more and remove completely that Svc abomination, but it's a bit more work.
Assignee: nobody → eoger
Status: NEW → ASSIGNED
Comment on attachment 8863924 [details]
Bug 1358648 part 1 - Clean-up some Weave imports.

https://reviewboard.mozilla.org/r/135652/#review138674

::: services/common/utils.js:14
(Diff revision 1)
>  Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> -Cu.import("resource://gre/modules/osfile.jsm")
>  Cu.import("resource://gre/modules/Log.jsm");
> +XPCOMUtils.defineLazyModuleGetter(this, "OS",
> +                                  "resource://gre/modules/osfile.jsm");
> +XPCOMUtils.defineLazyModuleGetter(this, "Promise",

I believe we can just kill use of Promise.jsm and DOM promises should just magically work.
Attachment #8863924 - Flags: review?(markh) → review+
Comment on attachment 8863925 [details]
Bug 1358648 part 2 - Remove util.js Svc.{DefaultPrefs,Session,Idle, FormHistory} and Str.

https://reviewboard.mozilla.org/r/135654/#review138680
Attachment #8863925 - Flags: review?(markh) → review+
Comment on attachment 8863926 [details]
Bug 1358648 part 3 - Remove Async, Services and XPCOMUtils from util.js.

https://reviewboard.mozilla.org/r/135656/#review138690
Attachment #8863926 - Flags: review?(markh) → review+
Pushed by eoger@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8d0b6d84a8e9
part 1 - Clean-up some Weave imports. r=markh
https://hg.mozilla.org/integration/autoland/rev/dff6d3f923d7
part 2 - Remove util.js Svc.{DefaultPrefs,Session,Idle, FormHistory} and Str. r=markh
https://hg.mozilla.org/integration/autoland/rev/9e6ae4133c2e
part 3 - Remove Async, Services and XPCOMUtils from util.js. r=markh
Priority: P2 → P1
Iteration: --- → 55.5 - May 15
No longer blocks: photon-performance-triage
Flags: qe-verify? → qe-verify-
You need to log in before you can comment on or make changes to this bug.