Merge pull request #14354 from Snuffleupagus/improve-pageKidsCountCache-further
Further improve caching in `Catalog.getPageDict`, for `disableAutoFetch` mode (PR 8207 follow-up)
This commit is contained in:
commit
2b8a5dce70
@ -1117,13 +1117,14 @@ class Catalog {
|
|||||||
|
|
||||||
xref.fetchAsync(currentNode).then(function (obj) {
|
xref.fetchAsync(currentNode).then(function (obj) {
|
||||||
if (isDict(obj, "Page") || (isDict(obj) && !obj.has("Kids"))) {
|
if (isDict(obj, "Page") || (isDict(obj) && !obj.has("Kids"))) {
|
||||||
|
// Cache the Page reference, since it can *greatly* improve
|
||||||
|
// performance by reducing redundant lookups in long documents
|
||||||
|
// where all nodes are found at *one* level of the tree.
|
||||||
|
if (currentNode && !pageKidsCountCache.has(currentNode)) {
|
||||||
|
pageKidsCountCache.put(currentNode, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (pageIndex === currentPageIndex) {
|
if (pageIndex === currentPageIndex) {
|
||||||
// Cache the Page reference, since it can *greatly* improve
|
|
||||||
// performance by reducing redundant lookups in long documents
|
|
||||||
// where all nodes are found at *one* level of the tree.
|
|
||||||
if (currentNode && !pageKidsCountCache.has(currentNode)) {
|
|
||||||
pageKidsCountCache.put(currentNode, 1);
|
|
||||||
}
|
|
||||||
capability.resolve([obj, currentNode]);
|
capability.resolve([obj, currentNode]);
|
||||||
} else {
|
} else {
|
||||||
currentPageIndex++;
|
currentPageIndex++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user