Speeding up Electron apps by using V8 snapshots in the main process
github.com
github.com
[1]: https://lwn.net/Articles/673724/ (2016)
[2]: https://lwn.net/Articles/707615/ (2016) and discussion here: https://news.ycombinator.com/item?id=13073566
Don't forget that Common Lisp and Smalltak implementations have had this since the beginning of time :D
Zygote processes do go through the initialization once, but then clone that pre-initialized state via forking. That makes launches faster, but importantly also reduces memory usage by sharing effectively read-only dirty memory across all processes (e.g. everything read into memory by each process via read() instead of memory mapping).
dyld closures seem to be caching process-specific linking precalculations, and prewarming just opportunistically (pre-)launches an app in case it's needed later. Same effect (faster launch time), but probably no memory savings, and a very different implementation.
Arguably at least as important as the speed/CPU usage improvements is the fact that this lets all processes share all "initialize once read never" memory that would otherwise have to eventually be swapped out once per process (or, in the case of Android, hang around until the app gets killed, since I think Android does not swap).
Java has had some similar abilities to rebuild the pre-compiled stdlib with whatever else you want already included. So, each Java instance both boots faster & has less overhead. Forgetting the name though! Node has options too! https://nodejs.org/api/cli.html#--build-snapshot
Copy pasted from NodeJS docs:
---
Currently the support for run-time snapshot is experimental in that:
1. User-land modules are not yet supported in the snapshot, so only one single file can be snapshotted. Users can bundle their applications into a single script with their bundler of choice before building a snapshot, however.
2. Only a subset of the built-in modules work in the snapshot, though the Node.js core test suite checks that a few fairly complex applications can be snapshotted. Support for more modules are being added. If any crashes or buggy behaviors occur when building a snapshot, please file a report in the Node.js issue tracker and link to it in the tracking issue for user-land snapshots.
---
(1) is fine as you can use a bundler to work around it. (2) can't, as far as I know, be worked around.
Although, yes, when I’m on resourced constrained machines, I open it in a Firefox tab.
Would cause FF to eat tens of GB, making FF sluggish until it crashed...
- Syntax Colorization of large source files.
- Auto-Completion Performance
- Rendering on Navigation when line lengths are very long.
Only thing Vim/NVim faster is Start-Up speed.
If someone care about speed actually, try Kate and Zed
Basically...I'd say this has more to do with the fact that Slack's development team doesn't get enough control over their applications in order to make things like this happen faster.
What I mean is: perhaps the path of least resistance (and thus the cheaper way) does not lead to good performance by default.
If only platforms and frameworks would make the fast way easy, and the slow way hard, it would be simpler to have faster software (not that it's easy to do).
Now, if only all programs had performance tests on all commits (like browsers use speedometer 3, and track the trend over time, because they know it matters to users).
A bloaty runtime (primarily because it's not shared across processes, as every app brings its own private copy of Electron) enables running the horrors of modern web development, i.e. pulling in thousands of libraries, sometimes each in several versions.
What sort of features do you find most important from VS Code?
The most important features for me would be responsiveness (I usually have multiple projects open simultaneously, and performance tends to degrade after a few days) and memory consumption.
Instead, Tauri (Electron-like framework) does it like that by default, using whatever you have installed instead of shipping their own runtime. Might be interesting if you're looking for a sleeker version of Electron (but made with Rust instead of mostly C++ and TypeScript).