Re-use, rather than re-creating, some Array
s when resetting them in src/display/api.js
Calling `someArray = []` will create a new Array, which seems completely unnecessary when it's sufficient to just call `someArray.length = 0` to achieve the same effect. Even though I cannot imagine these particular cases having any noticeable performance impact, similar changes were made in `core/` code years ago since it's apparently more efficient memory wise.
This commit is contained in:
parent
d0892e46e2
commit
8857a81c8d
@ -1377,7 +1377,7 @@ class LoopbackPort {
|
||||
}
|
||||
|
||||
terminate() {
|
||||
this._listeners = [];
|
||||
this._listeners.length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1760,8 +1760,8 @@ class WorkerTransport {
|
||||
waitOn.push(page._destroy());
|
||||
}
|
||||
});
|
||||
this.pageCache = [];
|
||||
this.pagePromises = [];
|
||||
this.pageCache.length = 0;
|
||||
this.pagePromises.length = 0;
|
||||
// We also need to wait for the worker to finish its long running tasks.
|
||||
const terminated = this.messageHandler.sendWithPromise('Terminate', null);
|
||||
waitOn.push(terminated);
|
||||
|
Loading…
x
Reference in New Issue
Block a user