Ask HN: Was programming more interesting when memory usage was a concern?
I got into doing programming professionally around 2014, which was way after memory and stuff was really much of a concern for 99% of all applications seemingly.
I always do look enviously at back when you had to figure out sort of bootstrappy ways to solve problems due to inherent limitations of the hardware instead of just sitting there gluing frameworks together like a loser.
Am I wrong or was programming just way cooler back then?
49 comments
[ 3.9 ms ] story [ 114 ms ] threadI’d say that garbage collection was key to large scale software reuse as if you didn’t have garbage collection you’d have to have a lot of cooperation between libraries and applications (how does the application know the library doesn’t need a piece of memory or vice versa?)
I don’t miss low level programming in a work context at all.
Memory mattered. Ditto CPU cycles, disk, and network bandwidth. (Not that your code could count on there being a network, in a lot of cases.) Security wasn't a Garden of Eden...but now that can feel more like being a night-shift ICU nurse during a COVID surge that never ends. And the software stack under your code was orders of magnitude smaller, and slower-changing. These days - that can feel like you aren't a programmer, but instead a Wall Street attorney who's trying to pilot some giga-corporate merger through the shifting regulatory and political obstacles in 37 different countries.
However, people go into programming for many reasons. For those who were not interested in squeezing out every word, it was not interesting. Probably some people realized their tasks couldn't be done in the limited hardware of the time, so didn't even try until memory became significantly cheaper.
The past can seem like a golden era of mythic heroes.
Some from the generation you envy are themselves envious of the previous generation, where programmers were expected to write their own operating system - the vendor didn't provide one - and pull out a soldering iron and oscilloscope for debugging.
When many were writing yet another COBOL program for accounts processing.
Anyway. No, it really wasn't cool.
The thing to realize is that software wasn't really that much better optimized for RAM than today. Maybe a bit, but mostly it just created a lot of pain:
- Every single API was specified to be able to fail due to OOM, and a lot of programmers tried to check for this and recover. However, there were no good ways to simulate or test it, and unit testing was in its infancy as a practice (e.g. no widely adopted frameworks for testing), and so in practice this just yielded a ton of codepaths and boilerplate that never really got tested and probably didn't work.
- Because RAM was so tight, you pretty much had to use the operating system's APIs for everything, even if they sucked or were full of bugs. It wasn't just RAM of course, it was also disk space, CD space, nearly non-existent network bandwidth. Duplication of what Windows had wasn't feasible. It meant everything was pretty consistent, which had its upsides, but it also meant that everything was consistently quite ugly and the horrible Windows/macOS APIs were all you got.
- Memory limits resulted in awkward APIs. No type safety, no enums (only bit flags), no reflection, lots of annoying (and by the late 90s obsolete) memory locking protocols that were holdovers from win16, and "rerendering" literally meant re-drawing small areas of the screen because pixels weren't cached. In particular a lot of APIs required you to call them twice, once to figure out how much memory something would require, and then a second time to fill out that memory once it was allocated.
- Error messages? Logging? Hah no. You get 32 bit error codes because there isn't enough memory or disk space for all the strings proper logging and errors would require. So you got really good at decoding HRESULTs.
- Garbage collection existed as a tech but because swap was so slow and RAM so tight it was very easy for it to trigger swap storms, so in common practice automatic memory management (when it existed) was all based on refcounting. So you couldn't quite just forget about it because you could still leak memory pretty easily even using a higher level language like VB.
The transition towards relative memory abundance was fairly painful. For example, Java because popular with devs because it had all those nice things that used a lot of memory but it led to slow/swappy apps that were painful for users. You still see the same complaints w.r.t. Electron apps, though today machines can take it and so it's more about people feeling it's wasteful rather than it literally killing the responsiveness of the machine like it used to be.
Of course in the above I say "was" and "used to be" but if you ever have to do any Win32 or low level POSIX programming you'll be right back in that world.
Since you mention an interest in this space, consider buying an Arduino kit and building some cool personal projects. Once you have some experience, look around your part of the world and identify any needs that you could solve with an embedded solution.
The more constraints you remove, the more something transitions from being a puzzle to being a canvas. Each end appeals to different kinds of people.
For anything that isn’t IO bound you are very often bound by memory access time. CPUs are incredibly fast and feeding them data to work on is very difficult, more so today than before!
The big difference is that a category of programming jobs has appeared where this is almost never a concern because it’s about shoving text around between servers.
I did measure so I can't say why for sure, but it was satisfying to see the exact same algorithm go faster.
I assume it was because it had better cache performance.
https://nnethercote.github.io/2023/03/24/how-to-speed-up-the...
3% and 6% of improvement doesn't seem like much, but at the level of rustc those big wins
Performance of Rustc must be continously tracked (here https://perf.rust-lang.org/) because if you don't proactively fight against bloat, the tendency is that the code will become slower over time (due to new features etc)
It seems like most things are web services these days though
Compared with (say) 20 years ago, you've got 20-50 times more memory, and your data is 20-50 times (or more) bigger.
We're doing the same as always, but using more bits, because bits are cheaper.
The machine had an 8-bit Z80 processors, 128k of bank-swappable memory (64k address space), and two 8" 240kb floppy disk drives.
The 8080 assembler source for my module was spread over 14 floppy disks. Compiling involved meticulously swapping floppies in the correct order for about a day and half. Inserting the wrong floppy in the wrong order would cause the build to fail, and you'd have to start over from scratch.
Despite that, one had a breathless sense that you were working with a technology that was about to change everything. The implications of the coming technological age were unmistakable. And the only limit was imagination and ingenuity.
Having a MILLION instructions a second to play with seemed limitless; but having to fit things into 16kb memory pages felt a bit constraining. For the most part, user data had to fit in a 16kb memory page because that was all that was left over after the operating system was loaded.
In retrospect, there's only so much you can do with a 4Mhz processor when you only have 16kb of data to work with, so processing power wasn't the constraint.
Probably exactly the same as what it's like to be working with AI technology today. Everything is going to change. And the future is going to be unrecognizable. And you're sitting in the middle of it.
So yes, absolutely, it was way cooler back then. Unless you're currently working on AI projects.
You're wrong, to be blunt.
Sure there's some interesting challenges to solve around keeping memory usage low, but mostly it was just tedious and limiting.
Programming has enough challenges and interesting optimizations without worrying as much as one used to have to about memory.
Whether it's artistic or scientific .. maybe it can feel a bit academic when we have so much memory and processing power available, but I personally think it really makes a difference.