Closed Bug 1658116 Opened 4 years ago Closed 4 years ago

Extension APIs should use defineLazyPreferenceGetter

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect

Tracking

(thunderbird_esr78? fixed, thunderbird80 fixed)

RESOLVED FIXED
81 Branch
Tracking Status
thunderbird_esr78 ? fixed
thunderbird80 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

(Keywords: perf)

Attachments

(1 file)

Some of the extension APIs are calling Services.prefs.get<>() every time they are called. From experience elsewhere, it has been seen that the preference APIs can be quite slow, and it is better to cache those values.

XPCOMUtils.defineLazyPreferenceGetter makes this easy for us, as it caches the values and handles any updates to those values automatically.

Doing this will help reduce the performance impact for add-ons that call various functions frequently, e.g. functions that return messages or a large amount of messages.

Of the current accesses, I think only doing the ext-mail.js and ext-mailTabs.js is probably ok. ext-cloudFile doesn't really fit (though it could cache the display name), ext-compose.js and ext-menus I think are unlikely to be hot paths.

I'm not entirely sure of the full impact here, I don't think it is major, but I'd still be looking at getting these uplifted to help generally with performance issues with WebExtensions.

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/comm-central/rev/1202539edcab
Use defineLazyPreferenceGetter to help performance of some of the WebExtension APIs. r=darktrojan

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch

Comment on attachment 9168983 [details]
Bug 1658116 - Use defineLazyPreferenceGetter to help performance of some of the WebExtension APIs. r?darktrojan!

[Approval Request Comment]
Regression caused by (bug #): Unknown.
User impact if declined: Probably only a small performance impact.
Testing completed (on c-c, etc.): Landed on c-c.
Risk to taking this patch (and alternatives if risky): Should be low - avoids re-fetching preferences every time certain WebExtension APIs are called.

Attachment #9168983 - Flags: approval-comm-esr78?
Attachment #9168983 - Flags: approval-comm-beta?

Comment on attachment 9168983 [details]
Bug 1658116 - Use defineLazyPreferenceGetter to help performance of some of the WebExtension APIs. r?darktrojan!

[Triage Comment]
Approved for beta

Attachment #9168983 - Flags: approval-comm-beta? → approval-comm-beta+

Comment on attachment 9168983 [details]
Bug 1658116 - Use defineLazyPreferenceGetter to help performance of some of the WebExtension APIs. r?darktrojan!

[Triage Comment]
Approved for esr78

Attachment #9168983 - Flags: approval-comm-esr78? → approval-comm-esr78+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: