News for hackers. Stuff that matters.
Re:Where’s all my CPU and memory gone? The answer: Slack by alkonaut on Thursday July 27, 2017 @06:50PM (#14870401)
Want to make an app that people use in the background? Music player? Chat app? Backup? Antivirus?

Then for gods sake make it lean. Set a resource budget and stick to it. Don't assume your product is a special snowflake that your users will want to waste resources on.

The easiest way is usually to just use a native toolchain and UI. Your users don't care how easy it is to find js devs.

Re:Where’s all my CPU and memory gone? The answer: Slack by BartSaM on Thursday July 27, 2017 @06:56PM (#14870447)
...and remember that Quake 3 required 64 MB to run, while Half Life managed to run on 96 MB of ram.
Re:Where’s all my CPU and memory gone? The answer: Slack by Narishma on Thursday July 27, 2017 @07:34PM (#14870706)
I'm pretty sure Half-Life required a lot less than that. The first PC I played it on only had 16 or 32MB of RAM.
Re:Where’s all my CPU and memory gone? The answer: Slack by oppositelock on Thursday July 27, 2017 @07:46PM (#14870794)
Those games were all written to "bare metal", talking to Win32, DirectX, etc. Most modern apps like Slack use a pile of giant frameworks which handle most cross-platform portability, at the cost of massive explosions of resource usage. It's a lot more work to write platform-specific code without those frameworks. I don't defend their choices, they're big enough to pay that cost, just explaining where this comes from.
Re:Where’s all my CPU and memory gone? The answer: Slack by mixedCase on Thursday July 27, 2017 @08:49PM (#14871064)
> It's a lot more work to write platform-specific code without those frameworks

Qt/QML abstracts over a ton of platforms, lets you write UI code in JavaScript, is extremely easy to pick up, has a WYSIWYG drag-n-drop editor and consumes a small fraction of the resources Electron does.

The overuse of Electron is not because everything else is impossibly hard; it's just old-school fashion-driven development.

Re:Where’s all my CPU and memory gone? The answer: Slack by oppositelock on Thursday July 27, 2017 @10:57PM (#14871589)
I've got a lot of experience with Qt, since I ported Google Earth from Windows to mac and linux, and it was Qt based back then. You have the problem of having slightly non-native feel because Qt has to code around platform differences to present a unified API. When we first released the app, we took a lot of criticism because of its non-native feel on all platforms (except for Linux, which doesn't have a native feel). So, if you want a top-quality app, you're probably breaking it apart into a platform independent core and then writing your interface separately on each platform using native API's. I wish that the cross-platform abstractions worked well enough to be indistinguishable from a native well-coded app, but we're not there yet.
Re:Where’s all my CPU and memory gone? The answer: Slack by mixedCase on Thursday July 27, 2017 @11:28PM (#14871727)
I didn't suggest Qt as an alternative for native toolkits to achieve a native look and feel; while it can be done it's a lot of work. I suggested Qt (specifically, QML) as an alternative to Electron, which doesn't care about native look and feel.
Re:Where’s all my CPU and memory gone? The answer: Slack by agumonkey on Friday July 28, 2017 @03:19AM (#14872569)
Bloat is making me so angry that I'd take an as400 textual interface as native feel any day. The web era is one step too much in the wrong direction to me. I enjoyed the hyper genericity of the web, but I'm tempted to say we need a little bit more of the flat and trickful things of the past.
Re:Where’s all my CPU and memory gone? The answer: Slack by NTDF9 on Thursday July 27, 2017 @07:43PM (#14870775)
You guys should remember that a lot of crap we write nowadays is a consequence of bloated languages and "move fast break things" attitude.

Doom and Half life were at their core exceptionally optimized C.

Re:Where’s all my CPU and memory gone? The answer: Slack by lostmsu on Thursday July 27, 2017 @07:51PM (#14870829)
Behind the trees you don't see a forest: Half-Life used 32MB of memory on 1024x768 display. By 4 or even 2 byte color it is 2MB just to store picture output. Modern apps work with 4k2k*4byte color, which on itself is 8 times more memory.
Re:Where’s all my CPU and memory gone? The answer: Slack by zeta0134 on Thursday July 27, 2017 @10:49PM (#14871562)
I think I understand the point you're trying to make (modern apps draw to larger screens, and therefore must use more memory) but this is a poor comparison for a number of reasons. The most obvious of these reasons is that graphics cards are leagues ahead of where they were back in the days of Half Life. Sure the framebuffer takes a bit more memory, but a 4k frame is only about 32MB of memory at 32bits per pixel.

Anyway, you're root argument is still somewhat valid: Half Life was working with some really tiny constraints compared to modern machines, and did amazing things within those limits. Modern apps, were they coded to the same level of optimization as Half Life, should be much, much smaller and more efficient than they are. But as it turns out, the human cost of developing video game software is high, and the one area where Electron truly succeeds is in its ease of use. By driving development costs down for non-game apps, it balances out its high resource usage, and to a company producing software, that's enticing. I think that's awful (and would prefer to run optimized software personally) but the industry seems to disagree with me.

Re:Where’s all my CPU and memory gone? The answer: Slack by prewett on Thursday July 27, 2017 @08:26PM (#14870986)
So, 2 MB for the display. And then there are the textures for the walls, plants, people, monsters, etc. And the vertex data for each of the models on the level. And the level itself. And then there are the light maps for static lighting. That's at a minimum. After that there is the memory required for the AI. Much of the models and textures won't be used in any given scene, but might get used in the next frame, or the next half second, and to avoid long pauses when a new model is loaded they all have to be in memory. If Half Life could have been done in less memory, I'm pretty sure they would have done it. It probably started off using a lot more memory and they probably spent a lot of time getting the memory down so that your mid-class machine could play it.
Re:Where’s all my CPU and memory gone? The answer: Slack by flukus on Thursday July 27, 2017 @08:27PM (#14870989)
So that accounts for 16MB of the 1500 used, where is the other 1484 going?
Re:Where’s all my CPU and memory gone? The answer: Slack by frik on Friday July 28, 2017 @12:53AM (#14872073)
Half Life 1 run on 32MB ram.
Re:Where’s all my CPU and memory gone? The answer: Slack by litor on Thursday July 27, 2017 @07:38PM (#14870736)
> Your users don't care how easy it is to find js devs.

Their user do absolutely care about UI/UX. If you're going to implement it native without all the "free" things you get from the web stack, and its popularity, the UI is most likely going to suffer.

Re:Where’s all my CPU and memory gone? The answer: Slack by reinierladan on Friday July 28, 2017 @11:41AM (#14875042)
I don't know about other platforms but on MacOS native apps are way better designed (looks and usability) than the electron crap that is available. So I'm curious, what makes you say JS devs are better at designing apps than native devs who know how native apps work?
Re:Where’s all my CPU and memory gone? The answer: Slack by Veratyr on Friday July 28, 2017 @12:41AM (#14872015)
They also care about battery life and system performance, they just don't know to blame Electron for any problems they have with those things.
Re:Where’s all my CPU and memory gone? The answer: Slack by na85 on Friday July 28, 2017 @12:37AM (#14872007)
What evidence do you have that js devs are any better at ui than native devs?

Most of the web is a usability nightmare.

Re:Where’s all my CPU and memory gone? The answer: Slack by Const-me on Friday July 28, 2017 @03:57AM (#14872720)
On Windows we have WPF.

Compared to the web stack, it packs much more free things relevant to desktop development. The examples of such things are animations, composition, data binding, pixel shader effects, and vector graphics.

Also WPF renderer is based on Direct3D, I would expect better performance.

Re:Where’s all my CPU and memory gone? The answer: Slack by kennydude on Friday July 28, 2017 @04:46AM (#14872889)
Telegram for macOS is fine except it could look and feel more native imho
Re:Where’s all my CPU and memory gone? The answer: Slack by loftyal on Friday July 28, 2017 @09:12AM (#14873978)
The solution to all of this is to use React Native, or a technology that is based on its principles to the desktop.