Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
All the debugging and instrumentation in a huge framework like electron, with so many parts like V8 and the JS bits and the system interface code and so on takes up quite a bit of space.
-
So what happened was, Web technologies which were originally invented for displaying documents could be contorted more easily into user interfaces than all current desktop-based UI frameworks. They also has the bonus of bring portable across all devices - kind of like Docker except from 1990 and each device has subtle bugs in its implementation.
Anyway - due to this, the fastest way to build something that runs on as many devices as possible from Day 1 is to base it on Web technologies.
Web technologies use a shit-ton of RAM because of things like the DOM and the Javascript engine - in general, the more complex / nested the interface is, the more RAM it will use.
Some genius came up with the idea to create a kind of "web browser host" shell to host applications built on Web technologies but allow tighter integration with the host system - and called it Electron.
There is some overhead involved with this, which uses up more RAM.
tl;dr: RAM is cheaper than developers -
@unsignedint I think "more easily contorted into user interfaces" is a fiction perpetuated by the costs being more subtle and harder to notice, especially with the "ease" of development. People forget that everything has a trade-off. Web technologies come with inefficient use of resources, massive software stacks (which often are poorly understood) and limited UI capabilities (despite the promises, true native UIs are almost always more flexible and therefore easier to fit to any particular purpose - web UIs can often limit what can be presented and how). Native UIs also tend to require greater knowledge of how a platform does things, which encourages better code.
In other words, people adopt things like electron because they seem easy. The hidden costs are paid by needing devices 10 times more powerful than might otherwise be necessary. (Some hyperbole might be included.) -
C0D4669445yScrap electron, you will see significant performance increases.
Plus you're complaining as a dev, how do you think the users will feel? -
The reason electron requires so much ram is the Javascript Engine's (V8) optimisations. To make Js faster the engine creates optimised versions of the code in multiple stages, each stage assuming more about types, branching, etc. The problem is that when these assumptions are broken, for instance by calling a function which was previously only called with floats with a string as an argument, the engine needs to revert to a more general form of the code. To do that the engine will keep copies of that code in ram, which eats up all of it.
-
repeat after me:
ELECTRON IS NOT A DESKTOP PLATFORM.
now go to your room and learn c#. -
@HnDev I dont think so, but I am not to sure. At the end of the day type script just gets turned into Javascript, which is what the engine sees. Also one can write type script in a way where one isn't strict about typing, so the engine cant assume types to be definite anyways....
How is it a thing that developing a desktop app nowadays requires an enormous amount of RAM? I stared working on an electron project and the whole thing takes up 3-4 GB of RAM when running, and that does not factor in my IDE or anything else.
But the packaged app does not go over 400mb, although we have had memory leaks in the past
rant
desktop app
javascript
electron