Inline the isRef
checks in the various XRef.fetch
related methods
The relevant methods are usually not hot enough for these changes to have an easily measurable effect, however there's been a lot of other cases where similiar inlining has helped performance. (And these changes may help offset the changes made in the next patch.)
This commit is contained in:
parent
1565d1849d
commit
34a53b9f5d
@ -1626,14 +1626,14 @@ var XRef = (function XRefClosure() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
|
fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
|
||||||
if (!isRef(obj)) {
|
if (obj instanceof Ref) {
|
||||||
return obj;
|
return this.fetch(obj, suppressEncryption);
|
||||||
}
|
}
|
||||||
return this.fetch(obj, suppressEncryption);
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
fetch: function XRef_fetch(ref, suppressEncryption) {
|
fetch: function XRef_fetch(ref, suppressEncryption) {
|
||||||
if (!isRef(ref)) {
|
if (!(ref instanceof Ref)) {
|
||||||
throw new Error('ref object is not a reference');
|
throw new Error('ref object is not a reference');
|
||||||
}
|
}
|
||||||
var num = ref.num;
|
var num = ref.num;
|
||||||
@ -1768,10 +1768,10 @@ var XRef = (function XRefClosure() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fetchIfRefAsync(obj, suppressEncryption) {
|
async fetchIfRefAsync(obj, suppressEncryption) {
|
||||||
if (!isRef(obj)) {
|
if (obj instanceof Ref) {
|
||||||
return obj;
|
return this.fetchAsync(obj, suppressEncryption);
|
||||||
}
|
}
|
||||||
return this.fetchAsync(obj, suppressEncryption);
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
async fetchAsync(ref, suppressEncryption) {
|
async fetchAsync(ref, suppressEncryption) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user