What's The Best Electron Alternative? Let's Find Out.
BBetter Stack
Computing/SoftwareSmall Business/StartupsInternet Technology
Transcript
00:00:00building cross-platform desktop apps used to mean reaching for electron but these days were
00:00:04spoiled for choice so to clear up any confusion today we're comparing the three best options for
00:00:09building cross-platform desktop apps we'll look at tori written in rust electro bun from the bun
00:00:14team dino desktop the new offering from dino we'll also use electron as a baseline and if you would
00:00:20like to see a different tool covered on this channel then just let me know in the comments
00:00:23we'll be comparing four things bundle size startup performance runtime performance and developer
00:00:29experience i've built the same app four times a screen recording tool that lets you edit the results
00:00:35on a timeline and output to mp4 i've specifically chosen this kind of app because video processing
00:00:40can push these kind of tools to their limits now of course not everything comes down to performance
00:00:44your team's skill set and the kind of product you're building will all influence the type of
00:00:49framework you choose but hopefully this can give you some guidance on what to expect
00:00:58so let's just quickly jump into a demo of the application we've built we start off by launching
00:01:03our app we can choose which screen to record then hit the record button now we can do a short record
00:01:08of the screen once we're done we can press stop then a window will appear with our recording on the
00:01:12timeline we can then clip this up to remove dead space then hit export to output as an mp4 the app is
00:01:18actually incredibly simple but because we're using multiple apis recording and processing video and
00:01:24rendering ui this should actually be a decent test so the first thing that we're going to check is the
00:01:28bundle size and remember these apps all provide identical functionality electron as the baseline is 323
00:01:35megabytes tori comes in at just 57 megabytes electro bun is 418 megabytes and dino was 111 megabytes
00:01:44all of them also have ffmpeg embedded for exports to mp4 and that brings 45 megabytes alone and electro bun is so
00:01:52large because i had to ship chromium with it i tried really hard but i literally could not get
00:01:56the screen record to work with the native system webview specifically to record from javascript
00:02:01you need the screen capture ipi and the get display media function you ask the browser for the screen
00:02:06it hands you a stream the media recorder encodes it and that's how electron and dino does it electro bun
00:02:12doesn't include that ipi at all so the only way to get access to it is to reintroduce chromium and that
00:02:17brings in an extra 200 megabytes of bloat dino's api did implement this so it's all of the same code
00:02:24but with no chromium and that's why dino's bundle size ends up being around 100 megabytes and electro
00:02:30buns ends up being closer to 400 and rust didn't need any of this because tori doesn't record from
00:02:35the web view at all it does it all through the back end through the native screen capture kit this is
00:02:40the same mac os framework that quicktime uses and it's all recorded directly from the back end you hand
00:02:46it a display a codec and a file path and it writes the file itself the web view is only the ui it never
00:02:52touches a single frame and you also get things for free that the javascript build has to handle
00:02:56screen capture kit mixes your mic and your system audio itself and it finalizes a proper mp4 i did
00:03:02also leave ffmpeg inside the tori app so we could export to different formats but technically that is
00:03:07actually optional okay now we can launch these apps to detect the startup time and i've written a script
00:03:13that does this 10 times so then i can take the median electron as a baseline was 273 milliseconds tori
00:03:19actually came in at 311 milliseconds electro bun was 773 milliseconds and dino was 242 milliseconds
00:03:29and the surprise here for me was that tori wasn't the fastest it's just a hair behind electron and then dino
00:03:34actually beat everyone the assumption would be that rust plus the system web view would mean instant
00:03:39starts but since the rendering engine still has to boot either way that's probably what contributes to
00:03:44the slightly slower startup speed electro bun is the outlier nearly three times electron it's booting
00:03:50a launcher which boots bun which boots chromium three run times in a chain and you can really feel it
00:03:56now let's look at memory after launch once the app is actually up and running electron is the baseline
00:04:01again and it was 128 megabytes tori came in at 109 megabytes electro bun at 208 megabytes and dino at 98
00:04:10megabytes so dino and tori were basically even and then electro bun was basically double everything
00:04:15else for tori that's nowhere near the 10x improvement that the marketing implies on disk yes it is much
00:04:21smaller but the actual memory footprint when the application is running is much more similar to the other
00:04:26tools and one thing to keep an eye on when you're actually doing these checks yourself tori uses the
00:04:31system web view and those processes aren't children of your app mac os starts them separately so
00:04:36activity monitor shows tori at about 36 megabytes and it looks like it beats electron three times over
00:04:42but it doesn't so when you add all of those processes up the 36 megabytes becomes closer to 109 megabytes
00:04:48which is what we recorded in the test in terms of the screen record itself i did notice much better
00:04:53performance from the tori app and this is probably because we're not recording the data in the web
00:04:58view and then transferring it over a bridge instead it's all recorded with the native sdk that comes
00:05:04with the system if you want to get closer to like 60 fps records then rust and tori is going to be the
00:05:10way to go now let's look at developer experience and due to each platform's differences this simple
00:05:15app was actually not straightforward to build at all overall electron and tori were the easiest to
00:05:20implement but dino and electro burn actually had a load of issues and system crashes in dino when we
00:05:26started a record and then hide the app the entire application would just close i think this is because
00:05:30when no screens remain visible dino just assumes that the application is done and so it just terminated
00:05:36the entire process so the hacky workaround for this was just to hide the view off screen instead
00:05:41electro burn had all of these issues around needing to bundle chromium for the screen record and for some
00:05:46reason the package actually depends on 3js and babylon js which are for 3d rendering which contributed to the
00:05:53bloated bundle size so all in all personally i would choose tori but if you really don't want to program
00:05:58in rust then electron is still the mature platform for typescript developers dino looks okay but i think
00:06:04the platform still needs some time to mature and then electro burn for me was the worst of all of them
00:06:09so hopefully you can make a judgment for yourself let me know what you think in the comments and we've also
00:06:13done a video entirely on dino desktop so if you want to learn more about that then you can click this
00:06:18video here otherwise i've been warren from betterstack thank you for watching and i'll see you next time