Reputation: 776
I'm developing an electron application and the thing I don't understand is how apps like visual studio code achieve so fast startup times, by that I mean the time between clicking the icon until a window opens (until main.js gets loaded).
I already read many articles about speeding up electron but they all just talk about the stuff that happens AFTER main.js is loaded.
I downloaded the electron-quick-start example and packaged it using electron-builder as portable app.
I was just wondering where the performance issue is, portable? electron-builder?
I found an issue in electron-builder that seems to indicate, that portable apps are extracted into a temp folder on app start, thats whats slow
Upvotes: 5
Views: 5692
Reputation: 776
Just to close this question:
As indicated in the comments, the problem really is the portable mode of electron-builder. Portable Apps first unpack themselves into a temporary folder on your computer which can be a cpu intensive task because of compression.
Only after the app files have been unpacked, the main.js is actually loaded by node / electron.
When using an installer, the unpacking is done during installation of course, and not every time the app is started.
Although it is nowhere mentioned in the electron-builder docs, the code seems to indicate that you can set a splashImage
bmp option:
/**
* The image to show while the portable executable is extracting. This image must be a bitmap (`.bmp`) image.
*/
readonly splashImage?: string | null
That would at least make it clear something is happening, instead of the user clicking the icon multiple times because the app doesn't open
Upvotes: 2