Kim Aldis
Kim Aldis

Reputation: 773

Electron app slow to start first time runnning

I've an electron app the start time of which is very slow - 20-30 seconds - when it runs for the first time after packaging. Subsequent times it's run the start time is 1, 2 seconds. Either; are there any thoughts on why this might happen or; are there any tools available that I might use to track the source of this.

macOS

Upvotes: 3

Views: 3507

Answers (1)

Aditya
Aditya

Reputation: 1329

Electron uses Chromium (Used By Google Chrome), maybe that's why when your application starts for the first time it takes time to make cache and other stuff, it also depends from Computer to Computer.

Some of the reason i've listed from the articles below.

Modules

for example you wanted to do some stuff but you are lazy and search for a module on which can do the work for you, i have no problem with that but sometimes modules have their own dependencies and those dependencies might have their own dependencies these dependencies can effect your start up time as "require" or "import" will load everything up which can cause your code be very big than it would've been if you wrote it yourself or downloaded a optimized small library to do same thing.

Using Synchronous Code

see i personally don't like the promise tree (the list of .then for handling asynchronous code) but if i use await or something it probably block my main process which can cause my application to freeze, that's why it's preferred to use promises.

Using Old APIs

In modern versions of chromium there might be better APIs for handling stuff which might be slow if you used old APIs.

Over all you don't need to worry if you're code will work on other browsers or not (until you're also making a web version of that too), because latest electron version will introduce latest APIs which will be shipped to your end users so don't worry if your code will work or not.

You Can Read These Articles Below Which may help you to increase your applications Performance:

  1. How to make your Electron app faster - DEV.TO
  2. Performance - ELECTRONJS.ORG
  3. Why are desktop apps made with electron js framework slow? - QUORA

Upvotes: 1

Related Questions