Avoid extra lookup/parsing when all destinations are already available
Whenever we cannot find a destination we'll fallback to checking all destinations, to account for e.g. out-of-order NameTrees, and in those cases any subsequent destination-lookups can be made a tiny bit more efficient by immediately checking the already cached destinations.
This commit is contained in:
parent
b8de9a372f
commit
254431df1e
@ -691,6 +691,11 @@ class Catalog {
|
||||
}
|
||||
|
||||
getDestination(id) {
|
||||
// Avoid extra lookup/parsing when all destinations are already available.
|
||||
if (this.hasOwnProperty("destinations")) {
|
||||
return this.destinations[id] ?? null;
|
||||
}
|
||||
|
||||
const rawDests = this.#readDests();
|
||||
for (const obj of rawDests) {
|
||||
if (obj instanceof NameTree || obj instanceof Dict) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user