Skip to content

Commit

Permalink
Fixed: benchmark was misreporting too many init calls
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jan 8, 2022
1 parent fca0104 commit 2d5be6c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Engines/Custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,21 @@ class CustomEngine extends TemplateEngine {
// If we init from multiple places, wait for the first init to finish before continuing on.
async _runningInit() {
if (this.needsInit) {
let initBench = bench.get(`Engine (${this.name}) Init`);
initBench.before();
if (!this._initing) {
this._initBench = bench.get(`Engine (${this.name}) Init`);
this._initBench.before();
this._initing = this.entry.init.bind({
config: this.config,
bench,
})();
}
await this._initing;
this.needsInit = false;
initBench.after();

if (this._initBench) {
this._initBench.after();
this._initBench = undefined;
}
}
}

Expand Down

0 comments on commit 2d5be6c

Please sign in to comment.