Skip to content

Commit 2130a41

Browse files
committed
Merge pull request mozilla-b2g#27780 from ochameau/tweakMultilocale
Bug 1108955 - Tweak multilocale optimize performances. r=stas
2 parents 170d093 + 1fee3ee commit 2130a41

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

build/webapp-optimize.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,21 @@ HTMLOptimizer.prototype._proceedLocales = function() {
139139
if (!this.webapp.asts[lang]) {
140140
this.webapp.asts[lang] = [];
141141
}
142-
for (let i = 0; i < this.asts[lang].length; i++) {
142+
let asts = this.asts[lang];
143+
let webappAsts = this.webapp.asts[lang];
144+
for (let i = 0; i < asts.length; i++) {
143145
let index = -1;
144-
for (let j = 0; j < this.webapp.asts[lang].length; j++) {
145-
if (this.webapp.asts[lang][j].$i === this.asts[lang][i].$i) {
146+
let identifierToFind = asts[i].$i;
147+
for (let j = 0; j < webappAsts.length; j++) {
148+
if (webappAsts[j].$i === identifierToFind) {
146149
index = j;
147150
break;
148151
}
149152
}
150153
if (index !== -1) {
151-
this.webapp.asts[lang][index] = this.asts[lang][i];
154+
webappAsts[index] = asts[i];
152155
} else {
153-
this.webapp.asts[lang].push(this.asts[lang][i]);
156+
webappAsts.push(asts[i]);
154157
}
155158
}
156159
}

0 commit comments

Comments
 (0)