Any ways to decrease startup time?

I’ve been evaluating Inkdrop quite a bit, and it’s been a very smooth app so far :clap::clap::clap: the only thing that doesn’t feel great is the startup time.

For example, my old system of note taking used Sublime Text 3 (a text editor) which takes about 300-600 milliseconds to start, but when I start Inkdrop it takes 4-6 seconds to start up.

I understand that the underlying app is Electron, so there’s limitations there, but I was wondering if there is anything else I can do to keep the startup time as low as possible?

As part of evaluating Inkdrop, I’ve written a few plugins to try to get importing and exporting working the way I want, and it looks like maybe Babel runs for the app or maybe for every plugin on load? Maybe I’m misunderstanding that, it might be cached so only the first startup requires Babel. If not, perhaps that could be an area to explore.

As a software person, the webapps and backend services I use are all JavaScript, and I’ve found some serious startup time savings by bundling the project into a single JS file, or into a small number of JS files. The require file resolution algorithm is very expensive with filesystem access, so bundling many hundreds or thousands of files into a single one can be the difference between a 20 second startup time and a 500 millisecond startup time (in Azure Functions or AWS Lambdas).

Anyway, just wondering if there’s anything I can do, and also offering my optimization knowledge and skills/experience to you if it would be helpful.

This article is a couple years old, but still very pertinent: https://blog.atom.io/2017/04/18/improving-startup-time.html

The part that’s still particularly relevant is the part on improving the require time. Their solution is snapshots, but I have personally had similarly good results without snapshotting, by creating bundles with e.g. RollupJS. For example, here’s a webapp template I’m using in a few production places, that uses RollupJS to create some bundles: https://github.com/saibotsivad/template-svelte3-asr-business

Hi Tobias,

Thank you for the suggestion.
Yeah, as you and many people say, Electron apps are so sluggish to launch.
It’s annoying for me, too.
Actually, I’ve invested a lot of time on this issue as I wrote an article like this:

I’m using webpack to build the app but it seems like not compatible with electron-link. So, it’s hard to generate v8 snapshot with the current build stack at the moment.

In the early versions, I’ve been bundling everything into a single js file with webpack. But it was basically the same startup time as the current version.
I guess that’s because Electron bundles everything into a single asar file.

Inkdrop’s plugin architecture is based on Atom as I mentioned in this blogpost.
You are right, Inkdrop has babel to transpile ES6 JS files for plugins and it caches them.
This file of Atom is the module for transpiled source caching.

So, I’m afraid that I’m not interested in working further on this issue at this point.
If I found a good way to generate v8 snapshot from my webpack source, I’ll be happy to try it.
Thanks again for letting me know your thoughts!

1 Like

That totally makes sense.

As always, thank you for your very detailed responses!

Good news - I’ve finally managed to make use of v8 snapshots for Inkdrop!!!
It shrunk the startup time by 1.5s on my mac.
For example, loading LessCache module became from 175ms to 10ms:

I can’t wait to roll it out! :smiley:

1 Like

It’s now in beta:

https://forum.inkdrop.app/t/v4-7-0-beta-testing/1834/47?u=craftzdog

Landed in v5.0.0 :tada: