[Pkg-javascript-commits] [pdf.js] 36/174: Cache the regular expression used for finding `obj`s in `XRef_indexObjects`, to avoid unnecessary allocations
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:45:06 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 9b12c64be57e960be6ff1ccca026a58a25d32444
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Fri Oct 2 12:46:58 2015 +0200
Cache the regular expression used for finding `obj`s in `XRef_indexObjects`, to avoid unnecessary allocations
---
src/core/obj.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/obj.js b/src/core/obj.js
index 204fd3f..ca92b77 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -1060,6 +1060,7 @@ var XRef = (function XRefClosure() {
}
return skipped;
}
+ var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114,
101, 102]);
@@ -1097,7 +1098,7 @@ var XRef = (function XRefClosure() {
position += skipUntil(buffer, position, trailerBytes);
trailers.push(position);
position += skipUntil(buffer, position, startxrefBytes);
- } else if ((m = /^(\d+)\s+(\d+)\s+obj\b/.exec(token))) {
+ } else if ((m = objRegExp.exec(token))) {
if (typeof this.entries[m[1]] === 'undefined') {
this.entries[m[1]] = {
offset: position - stream.start,
--
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