Closed
Bug 1362225
Opened 7 years ago
Closed 7 years ago
Speed up localized message generation
Categories
(WebExtensions :: General, enhancement)
WebExtensions
General
Tracking
(firefox55 fixed)
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: kmag, Assigned: kmag)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
A lot of the overhead here is in calculating the locale list, which we can cache, and interpolating substitutions, which we can skip for messages that don't contain a "$".
Comment hidden (mozreview-request) |
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8864696 [details] Bug 1362225 - Speed up i18n.getMessage. https://reviewboard.mozilla.org/r/136340/#review139660 ::: toolkit/components/extensions/ExtensionCommon.jsm:1170 (Diff revision 1) > cloneScope: null, > }; > > - options = Object.assign(defaultOptions, options); > - > - let locales = new Set([this.BUILTIN, options.locale, this.defaultLocale] > + let locales = this.availableLocales; > + if (options.locale) { > + locales = new Set([this.BUILTIN, options.locale, this.defaultLocale] It looks like you don't need to re-filter all the locales in this case, i.e., this could just be ``` if (this.messages.has(options.locale)) { locales.add(options.locale); } ``` ::: toolkit/components/extensions/ExtensionCommon.jsm:1322 (Diff revision 1) > return Locale.getLocale().replace(/-/g, "_"); > }, > }; > > +defineLazyGetter(LocaleData.prototype, "availableLocales", function() { > + return new Set([this.BUILTIN, this.selectedLocale, this.defaultLocale] It doesn't look like selectedLocale was included before but now you've added it?
Attachment #8864696 -
Flags: review?(aswan) → review+
Assignee | ||
Comment 3•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8864696 [details] Bug 1362225 - Speed up i18n.getMessage. https://reviewboard.mozilla.org/r/136340/#review139660 > It looks like you don't need to re-filter all the locales in this case, i.e., this could just be > ``` > if (this.messages.has(options.locale)) { > locales.add(options.locale); > } > ``` That would change the ordering, and we'd still need to re-filter. Anyway, this doesn't matter all that much, since it's only used at installation time. > It doesn't look like selectedLocale was included before but now you've added it? It was the default value for options.locale. This is only used when no options.locale value is provided.
Pushed by maglione.k@gmail.com: https://hg.mozilla.org/integration/autoland/rev/65f5ee1f5db8 Speed up i18n.getMessage. r=aswan
Comment 5•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/65f5ee1f5db8
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•7 years ago
|
Blocks: webext-perf
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•