Live data from Hacker News

Ask HN: Was programming more interesting when memory usage was a concern?

news.ycombinator.com

41–50 of 50 posts

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#41
I first learned programming in the early 80s, but never took it too seriously until the mid 2000s. I first learned Python at a time when I thought I'd do most of my serious work in Java.

That was a time when Python was rarely someone's first language. People would say, "Try Python, your programs will be about a third as long as they are now!" I was skeptical, but holy heck those people were right.

I am academic enough to enjoy the intellectual challenge of being conscious of memory usage. But when you had to pay attention to it in every project, it was not always fun. It was really fun to use Python and forget about memory for a while. I built many projects in Python that I probably wouldn't have made time for in Java.

I really enjoy programming these days, where you can forget about memory until you have a reason to optimize. Then when you do need to optimize, you can profile your code with fantastic tools, reason about memory enough to get things working efficiently again, and move on with the project. I really enjoy hopping back and forth between focus on a larger project, and focus on the inner workings of a project.

I think we're seeing the same kind of fundamental change with GPT-assisted programming. There's a whole generation starting to use these tools right now who will ask a question on a 2040s version of HN, "Was programming more interesting when correct syntax was a concern?"

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#43
I still worry about memory usage every day, and I’m writing Typescript for a single page React app.

Sure, there’s more memory these days and many languages make memory correctness errors a thing of the past, but play your cards wrong and you’ll exhaust your users’ resources just the same. In many ways it’s harder today because you can’t easily look at an abstraction and understand its memory or cache cost in languages like Java, Python, or JavaScript. you just pray it’ll get optimized or won’t cost too much and big-O analysis is enough. I can’t tell you how many times I’ve heard programmers working with GC languages worry about GC pressure or GC pauses.

You can always work in Zig, C++, Rust, etc to make reasoning about memory use easier. There’s more positions today working in those contexts than in the past, even though they’re a smaller overall percent of the market.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#44

Its still a huge concern. Cache today is what memory was in the 80s and 90s. Memory today is what disk was. And your L1 cache today might be 64kb! That’s basically what you can work with if you want to use your CPU at full speed. 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 b…

I have changed a program to use a smaller struct in a recursive function call and improved the speed significantly.

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.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#45
post #37
post #32

> Am I wrong or was programming just way cooler back then? 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.

I disagree. I think constraints (such as memory availablity) are a useful device to encourage creativity.

There's still easily enough constraints to be had to make programming interesting.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#46

Its still a huge concern. Cache today is what memory was in the 80s and 90s. Memory today is what disk was. And your L1 cache today might be 64kb! That’s basically what you can work with if you want to use your CPU at full speed. 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 b…

I have changed a program to use a smaller struct in a recursive function call and improved the speed significantly. 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.

A lot of effort is spent to reduce the size of structs in the Rust compiler

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)

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#47
As a former pascal, C, assembly programmer I learned perl, python, lua and finally type/javascript (when it became decent) and never looked back. It was cool, but not-worth-it-today kind of cool. When I think about cascade-freeing my pointers again or [de]serializing a struct for storage or ffi, I shudder. We digged the same ditches again and again and again.

I was pretty late into it (ca 2000) and can only imagine the pain of switching banks, mapping windows, dealing with segments and overlays, unloading things. When you hear about “cache invalidation and naming things”, don’t you ask yourself what the hell is “cache invalidation”? Lucky you.

There’s so much you can do today in just a few hours. But if you want that feeling, start with npm-remove-ing your bundler. That’s not the same, but the feeling will be the same.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#48
post #45
post #37

Earlier quoted context omitted.

I disagree. I think constraints (such as memory availablity) are a useful device to encourage creativity.

There's still easily enough constraints to be had to make programming interesting.

True, but I think constraints are essential for creativity.

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.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#49
post #9

It was more interesting in the sense of “May you live in interesting times.” I don’t miss low level programming in a work context at all.

I don't miss restrictions when writing code, I miss them when reviewing code.

I miss them when hunting bugs.

Re: Ask HN: Was programming more interesting when memory usage was a concern?

#50

Its still a huge concern. Cache today is what memory was in the 80s and 90s. Memory today is what disk was. And your L1 cache today might be 64kb! That’s basically what you can work with if you want to use your CPU at full speed. 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 b…

> For anything that isn't IO bound

It seems like most things are web services these days though

Post reply on HN