[Pkg-javascript-commits] [pdf.js] 24/109: Avoid more allocations for RTL text in bidi.js
David Prévot
taffit at moszumanska.debian.org
Fri Sep 25 03:04:13 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit b1cf4d98ad98cb80e1ce793cd384516a2f8a0c1c
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Fri Aug 14 15:49:39 2015 +0200
Avoid more allocations for RTL text in bidi.js
Instead of building the resulting string char-by-char for RTL text, which is inefficient, we can just as well `join` the `chars` array.
---
src/core/bidi.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/core/bidi.js b/src/core/bidi.js
index 511c5c1..331dee9 100644
--- a/src/core/bidi.js
+++ b/src/core/bidi.js
@@ -412,14 +412,13 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
// don't mirror as characters are already mirrored in the pdf
// Finally, return string
- var result = '';
for (i = 0, ii = chars.length; i < ii; ++i) {
var ch = chars[i];
- if (ch !== '<' && ch !== '>') {
- result += ch;
+ if (ch === '<' || ch === '>') {
+ chars[i] = '';
}
}
- return createBidiText(result, isLTR);
+ return createBidiText(chars.join(''), isLTR);
}
return bidi;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list