[client-app] delay building new hot window to improve win perf

Summary:
This improves window open times by about 70ms
We would spend a very long time in the backend browser process building a
new hot window when we didn't need to do that until much later

Test Plan: manual

Reviewers: halla, mark, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4311
This commit is contained in:
Evan Morikawa 2017-03-31 12:17:34 -07:00
parent 590b17ae6f
commit 4deef8b90c

View file

@ -48,7 +48,6 @@ export default class WindowLauncher {
this.createHotWindow()
}
win = this.hotWindow;
this.createHotWindow();
const newLoadSettings = Object.assign({}, win.loadSettings(), opts)
if (newLoadSettings.windowType === WindowLauncher.EMPTY_WINDOW) {
@ -70,6 +69,12 @@ export default class WindowLauncher {
}
win.setLoadSettings(newLoadSettings);
setTimeout(() => {
// We need to regen a hot window, but do it in the next event
// loop to not hang the opening of the current window.
this.createHotWindow();
}, 0)
}
if (!opts.hidden && !opts.initializeInBackground) {