103 points · by dosy · 7y ago · 135 comments
Of which the runtime is about 120.3 MiB. There is even a copy of ffmpeg (2 MB) for the rare occasion when you want to play back an mp4 video in your color picker.
The actual app itself is in the resources directory which is 1.8 MiB large.
This directory contains files electron.asar (214 KiB), app.js (1.7 KiB), package.json (727B), and directories static (152 KiB) and node_modules (1.4 MiB).
The actual content created by the author is in app.js, package.json and static, which together take 160 KiB, of which 52 KiB is the logo (would have been much smaller as SVG) and 68.8 KiB a bundled font.
In the node_modules directory major contributors for size that I see are:
* node_modules/tinycolor2/demo (288 KiB; largest contributor here is a jquery copy)
* node_modules/tinycolor2/docs (228 KiB)
* node_modules/tinycolor2/test (116 KiB)
* node_modules/electron-settings/node_modules/fs-extra/docs (96 KiB)
* node_modules/electron-settings/node_modules/fs-extra/CHANGELOG.md (56 KiB)
* node_modules/user-media-screenshot/.idea/ (44 KiB)
All of the stuff I listed above is quite redundant for the users who just want to run the app. If you remove them, the 1.8 MiB become 764 KiB for the entire app and I'm pretty sure that minifiers, bundlers etc. could make it even smaller.
The runtime could be provided by the OS. I think it's definitely possible to create apps < 500 KiB with web technology, it's just the deployment patterns that turn this into a major download of 122 MiB. As for the RAM usage, idk about that. I guess if the runtime is provided by the OS, it would be the same electron binary so the OS could share that one at least.
Including only the bundled/minified app is possible, leaving no node_modules folder at all - or, at least, just the native binaries needed.
As for bundling the whole Electron runtime on every app: technically it's possible to have a shared runtime - as this 3-year old issue shows, many people have attempted various approaches: https://github.com/electron/electron/issues/673
However, sadly no one has stepped up to come up with a general solution. While there are disadvantages and some reasonable arguments for bundling the exact version of the runtime required by an app, it seems efficent use of resources isn't enough of a priority..
Is there an idiom or ethos in node land that aims for tiny re-usable packages? I am not criticising if there is, just genuinely curious.
I have been writing JS applications for years and it's only since node and npm hit the scene that this has occured.
But everyone just goes ahead and pulls in Chrome.
It's shameful, and the worst part is that I get it - at this point I'm suggesting we go to Electron for a new application at work because it seems like the best maintained UI frameworks with readily available 3rd party components are all web based.
Now that Java is being developed at such a speedy clip at the cost of breaking changes, we may see Java runtimes being shipped with apps. (I'm personally still on Java 8 because that was the last release before drastic breaking changes started happening.)
Just kidding. Java has been abandoned in favor of web apps anyway.
I don't hate web technology, I just hate electron's distribution model. There are so many frameworks to get around this.
The problem? When you start to have 5-6 apps running with Electron in the backend and start to take 10% of your CPU time and 2 Gigs of RAM, you will start to feel how it impacts your working environment, battery life and all.
On a serious note: I never understood why people tell me to buy better hardware to compensate for the shitty performance of their software. No, fix your software!
I read about this dude who purposely writes software on a shitheap laptop just so that "if it's fast here, it's fast on modern mobile phones."
Even my app written in Elixir and uses 160MB of RAM after letting it run for a week; I've been thinking: "Maybe I could bring it lower to what nzbget uses (around 59MB)". I've been exploring Nim for that.
We need a return to small-footprint as a feature.
EDIT: edited to make it less ambiguous
It's 120 MB for literally a fucking color picker.
Color Picker for Windows (500KB) (1.6MB unzipped): http://instant-eyedropper.com
Significantly smaller than the Electron app and works across Windows XP to 10.
---
#h::
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
StringLower, color, color
clipboard := SubStr(color, 3)
---
It's bound to Win+h (hex color) by default.
It's not fancy, but it works. You just run it in the background and hit the hot key to copy the color whenever you want to. There is no UI.
What's neat about it is the entire source code fits in a tweet: https://twitter.com/nickjanetakis/status/1108825825116332032
And it uses 0.6MB of RAM when running.
AHK can be used to trivially fix many usability warts you have with random software, and is powerful enough that someone implemented a clone of dwm tiling window manager in it (bug.n, [0], I used it for more than a year and can attest it works very well).
--
I'd go as far as saying AHK is one of the few tools on Windows that I really miss when on a Linux system. It's that good and I don't even know it too well, I just hack things together as needed. Bash is great and all but AHK does so many useful GUI things.
Thanks for the link on bug.n. I use i3 on my Linux laptop and for day to day usage I do prefer a tiled window manager of some sort. My Windows box is my main workstation so having some type of proper tiled wm would be really nice. Currently I use dexpot (virtual workspaces), AHK (global hotkeys), keypirinha (fuzzy find app launcher) and the built in Win 10 window split shortcuts to get as close as I can to an i3 set up.
Excuse me, this is one of the tiniest and most useful things i've seen in my life as a budding designer.
It was something I whipped up in 5 minutes about a month ago when I really wanted a quick and dirty color picker. I do use it in practice.
One shortcoming is it doesn't visually show the color after you copy it, but that could also be done with AHK. You could totally have it show a small 16x16 window with the color which would disappear after 2 seconds and would get refreshed after you pick a new color if it were still visible.
You could even go 1 step further and change it to zoom around your cursor on key press, and then copy the color on mouse click while showing a 16x16 window color preview on hover. That would be the ideal solution, but something like that might be 3-4 hours of hacking around with no real AHK knowledge instead of 5 minutes and that wasn't worth it to me at the time.
Who cares that they used the “wrong” language or framework, or could have solved it another way or “who need this functionality anyway”.
Isn’t this supposed to be what the dev spirit is about?
Cross platform application development is considered a "solved problem" with Electron, and it's developed a cult that leads people to disparage native applications and native development as inferior in all cases, as if Electron were already the best possible solution rather than a hack around webdev that blew up because of the SV hype machine.
Because of this commoditization around a single language and a single framework (mostly by corporate interests, mind you,) curiosity and innovation are halted in favor of developer time efficiency and resume visibility. No one is even going to bother trying to create the next cross-platform application solution after Electron, because they would only be able to do so in Electron.
It's getting kind of ridiculous.
So what matters is the "why" and the "what", and we can just forget about the "how"? Engineering is all about the how we do things, and HN tends to have more engineers than your typical online community. What's wrong with that?
Someone spent their free time to give the world something free, shame on them it's not perfect.
And for size fetishists: it weights 42KB.
Maybe.
It looks like it's been spun out into `x11-apps` on debian based distros in the last year or two, and for some reason I don't have that package installed despite using X
And the EXE is only 32 KB when UPX is applied on it. And uses only 1 MB of RAM when running.
You can do the same thing in MS Paint and save yourself 15 seconds.
1) Take a screenshot.
2) Paste it into Paint.
3) Use the eye dropper to select the pixel that has the color you want.
This is the equivalent of editing a file with Notepad++ instead of opening it in Visual Studio.
The only problem I have with MS Paint is that it doesn't give me the hex value of the color I picked, only the individual RGB values.
I'm absolutely sure it is possible to write the same cross-platform app for less than 500KBytes and no dependencies.
This is an answer without a real problem, for Mac users anyway.
Everyone here loves to virtue signal about how horrible programs that take 0.01% of the space of a normal SSD and 1% of the RAM are, but the fact is that it does not matter at all, and you wouldn't even have noticed if you hadn't intentionally looked at the size of it.
For that matter, I did notice the size, as I'm browsing on a mobile connection (travelling) and the 55M color picker utility would take a bit over 2 minutes to download.
Phones for example have basically been unchanged for 5 years regarding performance, because while hardware has drastically improved the apps have become heavier in proportion for superficial new features. Same goes for internet connections.
As another example I'd say that the recent resurgence of deep learning has mostly come from (or at least was catalysed by) cheap, affordable GPUs, which only exist because gamers wanted better and better graphics.
How about developer time of 1 person vs. hardware (and electricity, CO2 emissions...) of 1 million users?
Do you actually have a million users? Can that developer time be spent saving even more hardware or human costs elsewhere?
Short thread on the matter: https://twitter.com/Wunkolo/status/1091572380315439104
[1]:https://medium.com/commitlog/electron-is-cancer-b066108e6c32
Don't really see how this improves it. I use Mac OS as well but I don't miss the color picker from Mac OS when I'm using Linux, not sure what his problem is. Or the attitude in general, I wouldn't want to be running something showing at all times such a cute name on screen. No thanks.
It has been over a decade, but I remember it being both straight-forward and pleasant to support Linux, Windows, and MacOS. I vaguely recall supporting Solaris too.
However, given macOS apps don't really support shared libraries (at least in the typical sense), it adds up pretty quickly if you've got a few Qt apps.
That includes all the tooling/headers/.a/etc.
See this for the accurate size for the Qt runtime: https://github.com/qmlnet/qt-runtimes/releases
Windows - 43MB
OSX - 32.2MB
Linux - 57.6MB
edit: u/781 has some experience with both and says Electron was faster to develop, his comment is below: https://news.ycombinator.com/item?id=19652691
See Qml.Net (https://github.com/qmlnet/qmlnet), or PyQt.
js targets the browser (angular, React...), the back-end (node), the desktop (Electron) and mobile (React native). Just like the Java of old with applets, javax, JME, and of course weblogic and friends, js today allows you to code anything, as long as you don’t mind doing it badly, insecurely and/or wastefully.
Due to this ubiquity, a large majority of job openings list js in one form or another as a prerequisite (remember when entreprise code was synonymous with Java?)
Once you know enough js to be dangerous, there’s little incentive to pick up another programming language.
It isn't replacing app dev. It's adding more app developers.
I disagree. Maybe that's true if you're a webdev unwilling to learn anything else, but Lazarus is the fastest way I've found to write cross-platform GUI software, and as a bonus it compiles to native code in a single executable.
https://kde.org/announcements/plasma-5.5/plasma-5.5-colorpic...
On Linux it seems confused with a muti-monitor setup, the orbit button does nothing.
On Windows, in a VM, the orbit button opens a web browser to https://www.tonymccoy.me/orbit/#ffffff and gets a 404 Not Found
https://doc.qt.io/qt-5/qcolordialog.html
KDE's KColorChooser is simply a wrapper around this and is less than 100 lines of code, mostly setting up the about box.
https://kde.org/applications/graphics/kcolorchooser/
This could have trivially been made into a cross-platform color chooser that uses significantly less resources.
On my Linux box Fucking Color Chooser spawns 4 fucking processes uses 128 MB of RAM and 4% CPU.
KColorChooser uses 15 MB in one process and near zero CPU.
Please stop making everything a web application.
A color picker is a tantamount example of an application that does not belong on the Electron platform.
but I also overrode the tooltip text on the screenshot cursor to display the RGB hex, as a ctrl+c will copy whatever is in this box
http://www.iconico.com/download.aspx?app=ColorPic&type=free
http://www.youngsmarts.com/download.htm
... and so on.
Also, opening up Photoshop for the color picker? Paint opens faster than I can blink and has a color picker.
There are a couple of other cool tools on the page too that I weren't aware of, like this:
http://www.nattyware.com/fontster.php
It's a HTML + Javascript desktop application that weighs 2 K. And it even uses native widgets and looks and feels like a real application. Isn't that something... ;)
With Apple you have to do things the special Apple way because Steve Jobs said so.
On Linux I am not thinking 'oh, where is my system wide colour picker and getting irate because there isn't one'. The colour picker works fine in the image editor program, with the browser add on I am covered for practically every use case.
Sure I had to add the browser extension and would be stuck without it, but my thinking was to get the browser extension rather than even think to install an OS widget.
I can't say that I have had a genuine need for a OS level colour picker ever. It is just not something needed. And no, just because I am not on an Apple machine does not mean I don't do anything 'creative'.
With Linux there are plenty of colour pickers already out there, 'pick' is very neat as it gives you a little screenshot of the context of where you got your colour from with a sensible colour name given too (albeit not a standard X-Windows style one, so you get 'Hot Cinnamon' instead of 'chocolate').
It obviously doesn't have a fancy preview, different representations or the other stuff you would get in a proper color picker, but it's fast and easy if you already have pyautogui installed and works on both linux and windows.
And I also think the slow "new document" screen is also javascript
Also let's not forget all those stupid creative cloud background updater jobs / services... that use node.js
Got me thinking about the meaning of c-word and I realized electron is a contagious form of cancer. It spreads from devs to user sure, but it is also spreading from devs to devs and more and more devs are using it. Fucking Microsoft has an enterprise product built in electron now. Who would have thought?