From aff0d563260a2eb20f0724197d5f29691b359d99 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 7 Jun 2020 11:56:04 +0200 Subject: [PATCH] Remove an unnecessary `RefSetCache.prototype.has()` call from `GlobalImageCache.getData` We can simply attempt to get the data *directly*, and instead check the result, rather than first checking if it exists. --- src/core/image_utils.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/image_utils.js b/src/core/image_utils.js index ea1090dff..2fbb93eb0 100644 --- a/src/core/image_utils.js +++ b/src/core/image_utils.js @@ -107,11 +107,10 @@ class GlobalImageCache { } getData(ref, pageIndex) { - if (!this._refCache.has(ref)) { + const pageIndexSet = this._refCache.get(ref); + if (!pageIndexSet) { return null; } - const pageIndexSet = this._refCache.get(ref); - if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { return null; }