Oh my, what big binaries you have!
— Written by socketPerhaps you saw sentiments like this floating around social media in the last few days, since the release of Node.js v20:
Node 20 allows you to compile your app into a single executable along with the entire Node.js core so you can run your apps on systems where node isn't installed, or your don't trust the system version.
@wesbos, https://twitter.com/wesbos/status/1648362070818140165
Node now ships with support for bundling your JS app with the full Node.js binary, producing a single, self-contained executable. It's kind of like Electron, but without the browser UI.
But yeah, people have definitely noticed, and had some fun with the fact that the "Hello World" of such an app is... (checks notes)... 88mb! Good grief!
Of course, that's trim compared to Electron, which can add 150mb+ to your app binary size! Yikes.
Size Matters
I probably don't have to tell you that there's a real, non-zero cost on the overall ecosystem to the ever-bloating sizes of applications, whether they be JS bundles shipped on every "website" page visit, or whether we're talking about downloaded apps to phones or laptops.
It's not just the initial download, but each re-download when there's an update. I remember a game I used to play on my phone that seemed to update every 2 weeks or so, and each update was over 120mb -- to my phone! I probably don't have to tell you how painful that is if I'm out on the road with 3g signal sans wifi. I loved that game, but I finally gave up on it because of those large update re-downloads!
Consider all the bandwidth congestion this is causing worldwide, every second. Consider all the wasted CPU cycles processing these huge app binaries. Think about all the extra power consumption (and battery re-charging!), and what that's doing to the global climate!
I think you get the point. We really should be paying a lot more attention to the size of our application distributions. It matters. Seriously.
Socket Runtime
Which is why I'm pleased to point out that Socket's runtime is literally ~1.5mb in size, for the major desktop platforms (Windows, Mac, Linux). And it's under 15mb for iOS, Android, and ChromeOS.
You read that right. That's all Socket adds to your app distribution size. The rest is your JS/HTML/CSS/etc web app that runs inside the webview. We don't bundle the webview itself with a Socket-built app, we link to and use the native OS's best webview.
And I think we give you a fair bit of power for just that slim 1.5mb. Full file system access (through a Node-like API in your web code), full TCP and UDP networking, including our P2P protocol, and Bluetooth.
We have plans to add access to a few more APIs, so in fairness, yes that 1.5mb will likely grow... a tiny bit. But rest assured, we're keeping a really close eye and tight control on what we ship on top of your application code. Even if the runtime eventually doubled in size (which it certainly won't!), that's clearly a lot better than 88mb or 150mb, right!?
Intrigued, and ready to take a look? Check out Socket's code and tools for yourself.