Re-factor resetting of StatTimer
instances to fix completely broken benchmarking (PR 9245 follow-up)
It turns out that PR 9245 unfortunately broke benchmarking completely, sorry about that! The bug is that we were attempting to reset the current instance of `StatTimer`, instead of creating a new one as was previously done. By resetting the current instance, the `StatTimer` data fetched in `test/driver.js` is now wiped out since it points to the *same* underlying object. This re-use of a `StatTimer` instance was asked for during review, and unfortunately I didn't test this thoroughly enough before submitting the final version of the PR.[1] --- [1] Note that while I did test the benchmarking scripts with that PR *before* initially submitting it, I did however forget to do that after addressing the review comments which might explain why this problem went unnoticed.
This commit is contained in:
parent
b6c57d9088
commit
d33c763dd5
@ -1056,8 +1056,8 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
}, this);
|
||||
this.objs.clear();
|
||||
this.annotationsPromise = null;
|
||||
if (resetStats) {
|
||||
this._stats.reset();
|
||||
if (resetStats && this._stats instanceof StatTimer) {
|
||||
this._stats = new StatTimer();
|
||||
}
|
||||
this.pendingCleanup = false;
|
||||
},
|
||||
|
@ -411,10 +411,6 @@ function isExternalLinkTargetSet() {
|
||||
class StatTimer {
|
||||
constructor(enable = true) {
|
||||
this.enabled = !!enable;
|
||||
this.reset();
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.started = Object.create(null);
|
||||
this.times = [];
|
||||
}
|
||||
@ -477,8 +473,6 @@ class DummyStatTimer {
|
||||
unreachable('Cannot initialize DummyStatTimer.');
|
||||
}
|
||||
|
||||
static reset() {}
|
||||
|
||||
static time(name) {}
|
||||
|
||||
static timeEnd(name) {}
|
||||
|
Loading…
Reference in New Issue
Block a user