Hacker News new | ask | show | jobs
by ChrisRR 1303 days ago
As an embedded developer it always surprises me that simple programs are still barely any faster, take 100s of MB of RAM, require a decent CPU despite the fact we're all using supercomputers compared to the Windows 95 days.

How is it that physicists and engineers are pushing the limits of physics to bring us ever faster processors and we still can't smoothly scroll a webpage, where as I can design an embedded product with a GUI on a 40MHz CPU

2 comments

Simple answer: because the software industry is a goddamned joke. It's full of complexity-fetishists who are arrogant enough to try and call themselves engineers while producing objectively terrible products and patting themselves on the back for it.

Remember a while back, when Casey Muratori told Microsoft their terminal emulator could be a lot faster if it used a glyph index, and professional Microsoft engineers told him that was complexity worthy of a doctoral thesis [0]?

There's a reason he got so mad at them, and its because this level of "competence" is pervasive in our industry and he has to see it every single f'ing day. See also: "When does the draw window change?", a demonstration of how Microsoft's flagship IDE's debugger fails to compete with a one-man project.

https://imgs.xkcd.com/comics/voting_software.png

[0] For anyone not in the know, this is essentially just emulating how a real dumb terminal from the 70s would work, is the blindingly obvious implementation, and would be familiar to just about any game developer on earth. Casey spent the next weekend coding a 3-orders-of-magnitude faster terminal display demo that was completely unoptimized as a demonstration of the lower bound of how fast a terminal should be. Microsoft's terminal is still not as fast, even though they did eventually implement his solution without, initially, giving him any credit.

There's a few things that have led to this trend, none of which are obviously 'wrong' or dysfunctional:

1. Better GFX quality. Modern screens have vastly higher pixel resolutions than before and vastly higher than any embedded device. Also everything now has to be anti-aliased by default and we expect sophisticated Unicode support everywhere.

This means UI is lovely and sharp - our stuff just looks fantastic compared to the Windows 95 era. But this came at a really high and non-linear cost increase because you can't do CPU rendering and keep up the needed pixel rates anymore. This has caused a lot of awkwardness, complexity and difficulties lower down in the stack as people try to move more and more graphics work to the GPU but hit problems of internal code complexity, backwards compatibility etc.

2. Windows dominance ended, meaning apps have to be platform neutral at reasonable cost. In turn that means you can't use the OS native GUI widgets anymore unless you're writing mobile apps or some artisanal macOS app - you have to use some cross platform abstraction. This also led to the widespread use of GCd languages for UI, because ain't nobody got time for mucking around with refcounting and memory ownership in their UI code anymore.

3. For various reasons like distribution and sandboxing, browsers met people's needs better than other ways of writing apps but browser rendering engines are massively constrained in how much they can improve due to the backwards compatibility requirements of the web again. Flash demonstrated that viscerally back when it was around. So a lot of potential performance got lost there in the transition to web apps, and memory usage exploded due to the highly indirect and complicated DOM rendering model which in turn needs layers of (non-mmap-shareable) code to make it digestable for devs.

4. Browser devs lost confidence in language based sandboxes and so moved to process based sandboxes, but a process is an extremely heavyweight thing - lots of CPU cost from all the IPC and context switching and especially expensive in terms of memory overhead.

You ask why is embedded different. Others here are asking why games are different. This is simple enough:

1. Embedded apps don't care about OS independence, don't care about security or sandboxing and only sometimes have large hi-res displays. If you're on a 40MHz CPU your display is probably a dinky LCD. You can lose the abstractions and write much closer to the metal.

2. Game engines and GPUs co-evolved with the needs of games driving GPU features and capabilities. In contrast, nobody was buying a hot new NVIDIA card to make their browser scroll faster. Games also benefit from historically being disposable software in which the core tech isn't really evolved over a long period of time, so devs can start over from scratch quite frequently without backwards compatibility being a big deal. Normal application software can't justify this. Of course games are going the same way as app software with Unreal becoming a kind of OS for games, but ultimately, it's shipped with the app every time and porting titles between major engine versions is rare, so they can change things up every so often to get better performance.

Could things have been different? Maybe. If just a tiny handful of decisions had been different in the late 90s then Jobs would never have come back to Apple and the dominance of Windows would have never ended. The iPhone would have never happened and Android would have remained a BlackBerry competitor at best, with a UI to match. If the Windows team had executed better and paid more attention to security basics like sandboxing, ActiveX could have remained a common and viable way to way to ship apps inside the browser. Flash might still be around because it was ultimately Google and Apple who killed it off by fiat - Microsoft wanted to compete via Silverlight, but were by then sufficiently respectful of anti-trust concerns that they wouldn't have simply announced they were going to murder it in cold blood.

So it's easy to imagine a parallel universe where our tech stack looks very different. But, this is the one we live in.