Closed Bug 1945464 Opened 1 year ago Closed 1 year ago

Investigate implementing TypeScript handling for XPCOMUtils.defineLazyGetter / defineLazyPreferenceGetter / defineLazyServiceGetter etc

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox139 fixed)

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: standard8, Assigned: zombie)

References

(Blocks 2 open bugs)

Details

(Keywords: perf-alert, Whiteboard: [addons-jira])

Attachments

(1 file, 1 obsolete file)

Investigating SearchService.sys.mjs with TypeScript I get various issues raised as a result of TypeScript not knowing about how the various XPCOMUtils.defineLazyGetter / defineLazyPreferenceGetter / defineLazyServiceGetter etc methods work.

We should investigate if there's a way we can make this work, or if we'll need to replace this with standards based functionality.

Prototype of a type-friendly design for handling all of the different
kinds of lazy imports and getters.

Assignee: nobody → tomica
Status: NEW → ASSIGNED

Note: this patch is just a demo for a possible type-friendly design for
different lazy things we need in gecko. It's not meant to be production
quality, the purpose is to gather feedback.

See also D238131 for another approach we're considering.

Attachment #9466070 - Attachment description: Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Mossop → WIP: Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Mossop
Whiteboard: [addons-jira]
Attachment #9466070 - Attachment description: WIP: Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Mossop → Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Standard8,arai,mossop,Gijs
Attachment #9466070 - Attachment description: Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Standard8,arai,mossop,Gijs → Bug 1945464 - Design type-friendly XPCOM.declareLazy() r?Standard8,arai,mossop
Blocks: 1955492

Here is some prior art within the devtools' performance-new code:
https://searchfox.org/mozilla-central/source/devtools/client/performance-new/shared/typescript-lazy-load.sys.mjs

This can be used this way:
https://searchfox.org/mozilla-central/rev/dd8b5213e4e7760b5fe5743fbc313398b85f8a14/devtools/client/performance-new/shared/background.sys.mjs#88-108

The various goals were:

  • should support different ways of importing (devtools' require as well as the usual Firefox way with ChromeUtils)
  • should allow for typescript types
  • not too magic (ie: prefer code over configuration)

It makes it more verbose than the alternatives, but also easier to understand for the users. It also works with more cases.

Attachment #9466518 - Attachment is obsolete: true
Pushed by tjovanovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/526b3d0ba7eb Design type-friendly XPCOM.declareLazy() r=Standard8,arai,mossop
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
Regressions: 1958019
Regressions: 1958807

(In reply to Pulsebot from comment #4)

Pushed by tjovanovic@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/526b3d0ba7eb
Design type-friendly XPCOM.declareLazy() r=Standard8,arai,mossop

Perfherder has detected a talos performance change from push 526b3d0ba7ebe24e98aad3e1535e586927651821.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
25% ts_paint linux1804-64-shippable-qr e10s fission stylo webrender 707.83 -> 532.25
18% sessionrestore_many_windows linux1804-64-shippable-qr e10s fission stylo webrender-sw 981.42 -> 806.42
18% sessionrestore_many_windows linux1804-64-shippable-qr e10s fission stylo webrender 1,022.00 -> 842.08
17% sessionrestore linux1804-64-shippable-qr e10s fission stylo webrender 1,027.83 -> 851.75
17% sessionrestore_no_auto_restore linux1804-64-shippable-qr e10s fission stylo webrender 1,049.17 -> 875.92
... ... ... ... ...
14% startup_about_home_paint_realworld_webextensions linux1804-64-shippable-qr e10s fission stylo webrender 1,214.92 -> 1,040.08

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 44625

The following documentation link provides more information about this command.

Keywords: perf-alert
Blocks: 1960107
Blocks: 1992437
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: