Live data from Hacker News

Ask HN: Will programmers write more efficient code during the memory shortage?

news.ycombinator.com

181–190 of 264 posts

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#181
post #106

Earlier quoted context omitted.

I disagree. Engineers choose the technical stack based on the specs. With LLMs, it's faster to ship even in a more verbose language like Go or Rust.

The language doesn't matter much if you have memory-hungry workloads. Whether it's Rust or C or C#, you can write quite memory efficient code in either.

Most apps don't need much at run time though. There may be a big database somewhere, but the majority of SaaS apps are just some form of CRUD with a clever twist that might change the data occasionally, but doesn't use most of it when you render a page. The user data required for any given page is dwarfed by the memory required to run the language that converts the data to an HTML view.

For example, if you're rendering a user account page that has 100 data fields (name, address, etc), that's a few kilobytes at most. If your code is using Node of PHP you're probably using tens or hundreds of megabytes, possibly gigabytes, to turn that into a stream of HTML to send to the user.

I suspect using Claude to turn all the Node and PHP apps in the world to Rust or Go would massively reduce the necessity for huge datacentres using terabytes of memory.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#182
It's not THAT much of a memory shortage.

It's not a memory shortage like the world had run out of gas for cars.

It's not like we suddenly only have 1MB of RAM to fit stuff into.

The memory shortage means stuff costs more that's all.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#183

Programmers will write more efficient algorithms if their employers tell them to trade time-to-market for hardware cost. Previously, it was trade hardware cost for time-to-market. "Programmers" don't make this decision, the product owner does.

The classic excuse for industry-wide incompetence. The average programmer today can't write good code even if told it's an explicit priority. The manager wants the Submit button to submit the form, they rarely care how the programmer does it. It's the programmer that chose to install the 11,000 node_modules, to use React with 3 layers of state management on top with hybrid SSR/CSR and to do Kubernetes because that's…

What is "good code"?

If you ask your boss, it will most likely be whatever spaghetti code which ensures the contract gets signed on time.

The boss doesn't care if the developer needs 10000 libraries for the submit button.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#184
It's definitely possible, but I agree with many other commenters it probably will not happen.

I wrote an encrypted mesh networking library that runs on normal operating systems. A customer asked me if I could make it run on an ESP32 with 520 kiB of RAM. At first this seemed impossible, but it turned out that it was, and not even that hard. While the original library was not memory hungry at all for a desktop CPU, it still wasted space on unnecessarily large buffers. Cutting those out made the library run on an ESP32 while leaving plenty of room for an application.

Also, my first PC was a 200 MHz single-core 32-bit AMD k6 with 32 MiB of RAM. This ran a graphical OS with browsers, word processors, 3D games and so on. Nowadays you can get a CPU with more than that amount of RAM as just built-in cache.

So a good place to start optimizing code would be to actually get a "severely resource constrained" computer and start making your code work on it.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#185
post #52

Algorithms and data structures aren't the problem, bundling Chromium to make a chat app is the problem. I think Rust's rise in popularity will probably lead to some benefits. Games will probably get more efficient but they're easier to scale down to the memory that's available.

> bundling Chromium to make a chat app is the problem. Precisely. And all that extra resource wastage is completely free! (paid by your customers). Perhaps if there were any big software companies who were so iconoclastic as to write fast software and avoid wasteful patterns like using Electron, pressure to do better could be felt, but every company that ships software[1] behaves the same so if anyone tries out compe…

You're forgetting about Apple and that entire ecosystem.

Android, too. Not much Electron to be found there. Both Android and iOS were heavily optimized for low memory environments back at the start.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#186
post #25
post #14

For this incentive to exist, the app needs to be such an obvious memory hog that users start identifying it as the source of the problem. Even then, a lot is required for most businesses to prioritize this (presumably) temporary issue at the cost of things like: participation in the AI race, other features, bug fixes, new markets etc. Heck, sometimes software is so inefficient that it costs developer and tester produ…

Your response suggests that you're only considering native apps where users can view memory usage. For cloud apps where the costs are largely hidden from users, the user has no way of doing that analysis. I agree with the second part of what you said, though: I expect businesses to just raise their prices in those cases rather than systematically focus on actual difficult engineering problems.

For cloud apps incentives are aligned already. The cost of memory usage falls on the people who are both paying for it and can control it. It's only really on end user devices where it's a problem, and only really on desktop class machines. iOS and Android were built in a RAM starved environment anyway and aggressively kill any non-foreground process that is using too much memory.

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#187
post #74

Earlier quoted context omitted.

Is there a single example of a successful LLM project apart from Claude Code?

If the CEOs are to be believed, then 75% of all new code in Google is AI generated. 46% of GitHub internal code, and roughly 30% across all of Microsoft is AI. Meta expects at least 65%, and snap reported 65% is AI generated. Its how software is built now in these palces.

[deleted]

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#189
post #106

Earlier quoted context omitted.

I disagree. Engineers choose the technical stack based on the specs. With LLMs, it's faster to ship even in a more verbose language like Go or Rust.

The language doesn't matter much if you have memory-hungry workloads. Whether it's Rust or C or C#, you can write quite memory efficient code in either.

Except that most of the time a workload is made memory-hungry by terrible technical decisions ("self-describing" text data encodings come to mind).

Re: Ask HN: Will programmers write more efficient code during the memory shortage?

#190
post #27

If that happens, we will see it in triple-A games first. If some new titles have significant lower hardware specs than expected. If buyers can't afford the hardware anymore, the studios need to adjust. It's definitively possible to scale games down a lot. There are a few AAA games that were "dumbed down" for the Switch 1 (Hogwarts, cyberpunk, ...). And that's a really low-spec device. There are two factors: existing…

> If that happens, we will see it in triple-A games first. If some new titles have significant lower hardware specs than expected. Recently I booted up Insurgency: Sandstorm. With a 5800X and an Intel Arc B580 at 1080p and high graphics, the game runs at around 200 FPS. Meanwhile, pretty much any modern UE5 title (with the exception of Ready or Not and Split Fiction, from what I've seen) runs horribly - the interesti…

Yes, Lumen (and raytracing in general) has a performance overhead. If you don't want that you can skip that feature. Split Fiction and other games choose to do so.

I think certain games like Robocop are awesome on UE5.

Post reply on HN