Use a buffer instead of string concatenation in reverseIfRtl
in src/core/unicode.js
This avoids creating intermediate strings and should be slightly more efficient.
This commit is contained in:
parent
24f80f1e38
commit
4e96d59fca
@ -1633,11 +1633,11 @@ function reverseIfRtl(chars) {
|
|||||||
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
let s = "";
|
const buf = [];
|
||||||
for (let ii = charsLength - 1; ii >= 0; ii--) {
|
for (let ii = charsLength - 1; ii >= 0; ii--) {
|
||||||
s += chars[ii];
|
buf.push(chars[ii]);
|
||||||
}
|
}
|
||||||
return s;
|
return buf.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user