128 points · 212 comments · 16 hours ago · amichail
news.ycombinator.com/item?id=48604232jakub_g
gsliepen
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.
cornstalks
In practice I expect most optimizations will come from "stop doing stupid stuff" and not "use fancy advanced algorithms." But that's a cynical perspective so don't be cynical like me.
jpollock
"Programmers" don't make this decision, the product owner does.
xlii
Even today it is possible to use languages and programming techniques to be ultra efficient when it comes to memory. It's not that difficult to use them but the world don't care.
Actual example: I have built same utility using Rust, Zig and Haskell (and Go, humorous writeup[0]). Rust binary is 450kb, Haskell binary 30mb. Zig was unfinished but I constrained memory to 512kb just for fun.
Thus it's not about memory per se but more about convenience. Many applications could be scaled by 1-3 degrees of magnitude in memory if they reused techniques but... no one cares.
4K resolution frame is ~40mb uncompressed. Another 10mb is 80k lines of text. Thus fitting in 50mb for 99.8% of applications should be perfectly doable with today's tech.
If the price increase would be per each next 1mb then maaaaaybeeee. But if it's like 100% over GB then I'm sure it won't have any impact.
[0]: https://xlii.space/eng/the-four-language-waltz-a-tale-of-all...
andix
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 gamers not able to afford upgrading. But also new gamers, that might only be able to afford much lower spec PCs than people who bought 2 years earlier.
Why games? Because there is a clear point where people stop buying games. Minimum hw specs are known before buying.
forinti
Young devs have not been exposed to this and they can get away with writing inefficient code most of the time, sometimes all of the time.
And even if there is a RAM shortage, we are still in the Gigabyte age. So I don't think we will go back to cycle and byte counting.
I can't even get some devs to care if their query runs in 3s or 8ms.
naet
In specific sectors I do think we will see more optimization. If you're working on cloud compute or AI training / large scale data processing, there will be a big focus on optimization as prices are very large at that scale and shortages have a bigger effect.
Also in gaming I think the next cycle will be different. Big game studios used to push for the best possible graphics that might require the newest consoles or high end gaming computers, but the next releases might not be as much of an upgrade. The next gen of consoles or graphics cards themselves might be delayed, or be less powerful, or be too expensive and flop, as chip manufacturing companies continue focus on more lucrative markets and leave average consumers behind.
jimnotgym
If your backlog is full of feature requests you will add features.
If your backlog is full of tasks to reduce memory usage, speed up areas etc., then that is what you will do.
Most programmers will have no choice whatsoever.
customguy
I wanna hang out with coders who care, I wanna read articles about caring and how you can achieve more with less code, and I want to see video content that visualizes the sheer insanity of it all. Like those "scale of the universe" videos, except the complexity isn't fascinating, but embarrassing.
Make it uncool, make software bloat a goober thing you people do at most because they "have to", for pointy-haired bosses, or because they're in a rush or under other constraints. Not something that just gets normalized because hey, thinking is hard, caring is hard, so let's all conspire and pretend we're not being deplorable slobs, under the "leadership" of even worse slobs. There is little technical difficulty here, it's mostly social. Ignorance and greed are in cahoots and don't want to get called out, so call them out.
Though I think to start with, you have to not give a shit about the majority, and huddle with people who care and make better things. If the majority comes around, great, if not, still better than standing on the beach, wondering if the ocean will ever spontaneously take this or that shape.
nrmitchi
Some big-tech orgs (that have their own hardware) will take costs into account, but they already do that. The "optimization" is more likely to be business-optimizations; "this can be slower if it uses less memory", rather than inventing new stuff.
Note that I am excluding any of the big AI labs. They are definitely going to be working to figure out how to use less memory, but that's primarily not related to the direct cost.
lesuorac
Will programmers write more efficient code during the memory shortage?
If we can insert "some" then Yes.
use of more advanced algorithms and data structures that use less memory?
I don't think so.
At least at work there is a push to decrease memory usage but the way I've seen it playing out is not using some O(N) data structure instead of O(N lg(N)) per-say but instead replacing `int[]` with `byte[]` or in-lining some fields to remove some indirection costs.
cco
Google has already downgraded memory for their upcoming Pixel 11 while at the same time imposing local running models as a first-class feature. Both decreasing the memory pool and increasing the demands on it.
The key is that they own the full stack (hardware and software) and can demand the OS be more efficient, along with perhaps forcing that goal on app developers as well via tightened background limits etc.
dijit
For most people; computers just suck now.
I work in AAA video games, and I'm often told that consoles hold back games. This is true in the most essential sense: for consoles we are forced by the first-parties to optimise our games so that they function on consoles at a reasonable framerate with not hitches.
Those optimisations help PC players too; and they have more hardware headroom so they can crank things up even higher: without those constraints games would be much heavier and would require you to be on a faster moving hardware cycle.
The same is true when I worked in ecommerce; there was a common verbiage which I don't remember verbatim but the spirit of it was "we lose 10% conversion every 100ms" - so we built our systems to do as much as possible within 100ms (including network RTT).
If people actually have target hardware, and a metric that they're pushed towards, it can happen, people can learn how to navigate the abstractions or do better with the abstractions they have... but I think this wont happen, because in the examples above there was an actual cost to things. Conversion rate is money, not being permitted to launch on console is money.
But you know what modern MBAs see as being money? Time to market & developer salaries. If every company has the same mentality: then it doesn't affect conversation in the same way. Those exogenous constraints simply don't exist in the majority of technology today. It's like a collective action problem.
If there was going to be a collective action against this for financial reasons we would have seen it, shipping laptops with 16G of RAM instead of 4G (or 8G) has a really large headline cost in a company of a few thousand people; but those companies never pushed hard on Teams or Slack.
dehrmann
advanced algorithms and data structures
This isn't where memory goes or real-world speed comes from. For most applications, it's abstractions like React running in electron that hurt performance. There are also richer resources backing parts of apps--higher resolutions, better quality, higher framerates.
mherkender
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.
swiftcoder
Apple recently released an 8GB MacBook Neo, which bucks the previous trend of increasing RAM in low-end SKUs, and signals that software needs to be prepared to run in that configuration for a long time to come. I expect we'll see similar moves in smartphones if RAM prices stay elevated.
tumdum_
frumiousirc
As a consequence of this fixed RAM/core ratio, substantial software development effort goes to either making jobs fit in 2GB or if that is not possible then to utilize multithreading. Generally, particle physics processing does not particularly benefit from MT except in this fixed RAM/core situation. Sometimes large memory jobs are needed (inherently or because of bloat that is too costly to improve). When run on the "grid", these jobs must allocate multiple cores just to get "their" memory. If those jobs can use the extra cores, overall throughput does not have to suffer.
That's for conventional software, which still makes up the bulk of the computing. The situation for the growing amount of GPU-accelerated software is different and more varied. One trend can be seen relating to VRAM. Research groups with easy access to big GPUs like A100 write code to fit or exceed the relatively copious VRAM limits of the data-center GPUs, while groups that lack easy access to DC GPUs but have access to more modest "gamer" GPUs write more advanced software that can fit the smaller VRAM. In some cases, they write the software so it can scale the computation, keeping GPU utilization high while staying just under the VRAM limit.
General budget crisis and limited resources in the particle physics field are in part responsible for all of this tailoring of the software to fit the hardware. If better funded, particle physicists could spend more time doing physics and less time squeezing last drops of processing power.
agile-gift0262
patrulek
astrobe_
pnikosis
kantord
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 productivity but a fix is not prioritized for years.
cryo32
The whole Electron “ship a browser for each app” ideology will die first.
wewewedxfgdf
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.
dainiusse
herbst
Most games are written for the 3% who can afford a luxury gaming PC. That's how the market is working for a while now.
martinald
I still often notice that servers on Linux use <1GB of RAM even with relatively high use. I don't think that's really changed massively in 20 years.
Shitty-kitty
winstonwinston
mirmor23
stepping outside of garbage collection, and managed runtime systems could teach a lot; there was a book written 20 or so years ago;
sneilan1
shinobi-apps
xp84
So, this carefree attitude directly shapes all code that runs client-side (JS + native apps) since the only impact on the company is whatever happens on the dev's laptop. The rest of the impact is "free" since it's paid (in either money or in misery) by customers.
For server side, I also highly doubt it, as being more memory efficient on the server side has always had a benefit to the company who pays the bill. The only things that may change may be the relative cost, but if management comes and says "AWS bill going up, help?" devs will say "OK, we can find ways to save RAM, but the team won't be doing any new features or fixing any customer-facing bugs during that time" and management will say "Okie dokie, we'll just pay the bigger bill then."
bborud
And not all exorbitant RAM use is about sloppiness. Sometimes you can trade more RAM use for lower complexity. Bugs and development time were expensive. RAM was not. So sometimes there is calculation rather than sloppiness behind certain types of heavy RAM use.
[deleted]
jbird99
asp_hornet
will programmers write
Who’s going to tell them?
warumdarum
bjackman
Feedback loops are the important bit. If you want to reduce your service's memory footprint, don't at the code look at the memory profile and monitoring. You will find something like "oh shit 30% of our RAM is used by these buffers that we could basically eliminate if we tweak the flush frequency".
If you automate/regularise those investigations you will get an efficient service.
Same is true of every other performance metric, and reliability. It comes from your engineering processes (alerts, qualification, prod experimentation) not "write better code".
HaloZero
A web browser and the basic mobile app will be fine.
The iPhone 17 Pro has the most RAM and it's only 12GB. Hell the iPhone 16 Pro only had 8 GB. The vast majority of consumer cases don't need it. I doubt Apple and other manufacturers will go beyond that to keep prices down.
harel
citrin_ru
tinco
WheelsAtLarge
Werewolf255
v3ss0n
renoir
int3trap
johanvts
comrade1234
sim04ful
segmondy
xnx
Computer: Rewrite this python code in Go. Make it memory efficient.
cheesecakegood
But I’m hopefully optimistic that we’ll see a renewed emphasis on speed and responsiveness, since users do notice that despite most products ignoring it.
jmclnx
When I started out, the mini computers were 16 bit and there was a limit to program size. You could do a lot within those limits, but once in a great while I did exceed the limits and the compile (if lucky) would fail or the program would dump. That was well before GUIs.
I believe the GUI portion of a program are the largest use of memory, so I do not even know if people today can survive without GUIs :)
koliber
xena
novafunc
sudoshred
rramadass
Niklaus Wirth wrote his A Plea for Lean Software in 1995. Pdf at https://people.inf.ethz.ch/wirth/Articles/LeanSoftware.pdf
People did not bother and then the Web made everything worse. We are now so used to layers and layers of abstraction, humongous libraries and frameworks that most do not know anything about how to write "lean" software.
Nothing is going to change in the application/services layer.
jklein11
linhns
casey2
physix
Economics will invariably alleviate the memory crunch. It just takes long and requires a huge upfront CapEx.
They have been burned in the past and are hesitant to over invest, worried that the bubble might burst.
I expect high prices to stick around for a while, but I would be surprised if this was permanent.
Which means to me, that price pressure probably won't be the driving force for writing more memory efficient software.
For those who want, I expect AI to make it easier to do that, assuming it's done right, i.e. not vibe coding it.
If you have a subscription to The Economist, I recommend listening to this Money Talks podcast. They talk about the shortage and the economics behind it.
Can anything stop South Korea’s bull run?
https://www.economist.com/podcasts/2026/05/21/can-anything-s...
__mharrison__
(Just refactored an app to do this. 60k lines to 20k)
Insanity
garyfirestorm
pjmlp
elAhmo
__s
vrighter
Those that didn't still won't
[deleted]
MaulingMonkey
Will programmers write more efficient code during the memory shortage?
Yes. No. Yes.
I've worked in gamedev, helping ship code that ran on consoles. Nice fixed hardware targets. You OOM, you crash. We crashed a lot, and cut and saved and optimized and explicitly invoked the garbage collector twice on level transitions, because a single full scripting language GC doesn't work when finalizers must run to deref C++ objects to unroot script objects, and committed other horrific hacks.
The memory shortage may eventually impact fixed targets like this. Or the minspec publishers will swallow for fuzzier targets like "PC". But it takes awhile for new targets to roll out, and for newly bought PCs to make a significant dent on total percentage of PC ownership. Steam Machine's about to release with 16+8GB and while price and market saturation may be affected by the memory shortage, I'd be suprised if the actual spec changed.
Maybe there will even be more interest in the invention and use of more advanced algorithms
Not for typical gamedev IMO. There the focus will be more on "reduce the amount of content loaded in memory simultaniously". That means less detail, smaller scale, or less variation. Going from 4096x4096 to 2048x2048 textures quarters your texture memory usage. The surface of meshes also has some square density nonsense going on. Basic animation tends to scale with bone count and keyframes, which are more linear, although shape keys are more per-vertex nonsense.
And of course, reusing the same mesh or texture multiple times doesn't use more memory, just more memory bandwidth.
Audio is more a factor of "how many sound effects (and variants) do we need preloaded just in case there's suddenly an event that triggers them".
These are the big ticket items for memory use and advanced algorithms don't help much. Rather, the algorithms help stretch whatever amount of memory you do have to provide the best amount of quality you can, and the small constant shift in total memory availability doesn't change the calculus for how important that is very much (which depending on the game ranges from "unimportant, everything fits in memory easily" to "critical, we're doing open world streaming and we've got terrabytes of raw data already, 16 vs 64GB of memory doesn't change that much")
and data structures that use less memory?
Some bit packing type stuff comes up for smaller logical data structures in gamedev, and that can be useful for saving memory bandwidth, but I'm skeptical of how critical it is for total memory usage outside of the occasional Factorio.
Joker_vD
Besides, have you heard about "virtual memory" and "swapping"? Nowadays, SSDs (and especially NVMe) are quite fast, so thrashing is much less of an issue.
digitaltrees
whateveracct
holoduke
DANmode
“The new MacBook only has 8 gigs of sheep - we need to go resource-lean!!1!”
thewhitetulip
Unless that changes we won't see any spike in optimization
jinpan
Jtarii
Uptrenda
jswelker
wseqyrku
Lionga
Devasta
You could be a senior dev with over a decades experience at this stage doing nothing but chucking react slop over the fence, performance may have never once come up as a consideration in that time.
burnte
m00dy
antisol
> Will programmers write more efficient code during the memory shortage?
Hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahareinitctxoffset
The hackers doing the drone software in Ukraine will go to enormous lengths to get something onto Jetson Orin, but once it needs Thor? New cost model.
I think what the parent might be asking is whether the cost of DRAM will be passed along to the most powerless actor in the system, and that depends on whether it's a real competition (war, HFT) or a pillow fight between frenemies (consumer Internet, too big to fail AI lab).
Us liberals have this quaint idea that good referees make capitalism an adversarial contest instead of a rolodex contest, but that idea is out of fashion at the moment.
tristanj
- everyone assumes their program / website is the only thing running at the machine at a given time, and dev machines are always more powerful than user machines
- it's not really lack of advanced data structures and algorithms that result in the bloat most of the time but the fact that programs and websites are delivered by large teams, there are dozens of submodules that are often loaded even when not needed, and doing it properly is hard to architect to without getting into big complexity and gnarly bugs waiting to happen when someone from other team modifies something and does not know full picture. So it's cheaper to just keep things the way they are to reduce complexity of architecture and fragility.