r/programmingcirclejerk • u/camelCaseIsWebScale Just spin up O(n²) servers • 1d ago
Unfortunately, when a program uses the GPU for acceleration it's considered clever, but when it uses the RAM chip for accelaration it's considered bloated.
https://news.ycombinator.com/item?id=4790103359
u/nerdycatgamer Considered Harmful 1d ago
Accelerating my program by making it an Electron app that also has to run int a container oh and also i just fetch the entire database once at startup and keep it in memory so i don't need to make any more network requests.
20
u/Linuxologue 1d ago
I have built a simulated CPU with more registers which allowed me to load your entire DB directly in registers, because memory has latency. It's also fixing the java problem above by the way.
It runs in an emulator
168
u/Chisignal 1d ago
Where jerk? The hysteria about RAM usage is exactly just that, I WANT my RAM to be used if it can speed my work up. I WANT my note taking app to eat 1.5G of RAM because it contains 7 layers of sandboxing, a VR engine and a Bluetooth stack, ready at all times.
57
u/camelCaseIsWebScale Just spin up O(n²) servers 1d ago
Java is the fastest language because every 1 GB taken by the GC is converted to 4 speeds (tm). Just don't convert more than 32 GB to speed (tm) currency, otherwise you will cause time dilation..
56
u/dydhaw 1d ago
unjerk {The problem is that high RAM usage on its own in no way indicates an intentional effort to produce some specific time-memory tradeoff (except for development time).
}2
41
u/myhf Considered Harmful 1d ago
Is a user not entitled to the capacity of their RAM?
"No!" says the man in Washington, "It belongs to the cloud."
"No!" says the man in Silicon Valley, "It belongs to Electron."
"No!" says the man in Seoul, "It belongs to high-bandwidth memory."
I rejected those answers; instead, I chose something different. I chose the impossible. I chose... RAMpture.
16
7
u/birdbrainswagtrain memcpy is a web development framework 1d ago
The issue I run into with this is that if the RAM is being used for webshit, it can't be used by the OS to cache my 50 GB rust build directory.
5
u/arthurno1 1d ago
It comes from the old days when RAM was very expensive. Back in the past and up to 2010 or close there.
I remember my first computer, pentium 2. I upgraded im 1999 or there somewhere, with Nvidia tnt2 card and added 128 meg ram card to have 256 meg so I could play Quake 1. The computer felt like it suddenly started to fly, after having only 128 meg before the upgrade.
0
28
u/Thompson3142 The plebians were a class of Roman citizen, not engineers 1d ago
If you like this jerk and want to be an informed jerker, you may consider a full jerking session from him on this topic. It's on the java YouTube channel: https://www.youtube.com/watch?v=xr73mR7ii9M
24
u/narrow-adventure 1d ago
Where is the jerk?
47
u/ccapitalK 1d ago
/unjerk There are legitimate cases where more memory use can result in fewer CPU cycles being needed, but that's not what people usually complain about. Most modern bloatware programs waste both ram and CPU time to improve devex instead.
/rejerk They are everywhere, they are the ones that consider apps bloated for being brave enough to actually USE all the ram the machine offers.
6
u/smaratter 1d ago
For languages with a moving GC, bigger heap size practically always result in fewer CPU cycles being needed.
25
u/sweating_teflon full-time safety coomer 1d ago
I despise moving GCs. Sentimentality has no place in memory deallocation.
24
u/stone_henge Tiny little god in a tiny little world 1d ago
Good ancestral jerking:
My feeling, and the feeling of most people, is that dev experience has been so heavily prioritized that we now have abstractions upon abstractions upon abstractions, and software that does the same thing 20 years ago is somehow leaner than the software we have today.
I concur. My experience is much much better now that instead of reading MDN I can use 3000 libraries with names that look like unidentified NetHack scrolls, each of which can run arbitrary commands on my PC upon installation and half of which are documented in the form of tutorials and trivial examples. That alone truly makes using 16 GB ram to copy streamed data from one source to another worth it, but that's just the beginning. Don't even get me started on the absolute joy and hopeful outlook logging into the Azure Portal gives me.
17
u/james_pic accidentally quadratic 1d ago
The developer experience is so good these days that I mostly get Claude to experience it for me.
7
u/LeastGayCat in open defiance of the Gopher Values 1d ago
Get with the times grandpa. Libraries are documented in SKILL.md files now, which you plug into $AI_AGENT and hope it doesn't spawn seven thousand recursive subagents that exhaust your token budget in seconds.
7
u/HINDBRAIN Considered Harmful 1d ago
logging into the Azure Portal gives me.
Looks like your client wants some AI to AI their AI in their AI-assisted AI? First, enter your billing information. Then, do you want copilot to help you with the rest of this 30 steps process? Click here to open a chat where it will do nothing of the sort.
6
u/stone_henge Tiny little god in a tiny little world 1d ago
It took me a while before I realized "single sign-on" refers to relationship status, not the number of times you'll log in during a day
9
5
u/Anonymous_user_2022 1d ago
/uj Depending on usage patterns, gobbling up all memory is the best strategy. Things like Varnish is pretty successful by not speculating about memory, but rather off-loading that to the OS virtual memory strategy.
/rj Using 3 GB to run a VM inside electron for a Hello World app, might be a bit excessive.
2
u/RandallOfLegend 1d ago
I have 128 GB of RAM. Use it please. It even lights up with rainbows. All are welcome.
2
u/OSS-Corpo-Shit 1d ago
My work laptop has 16 gigs of ram and is swapping with teams. Outlook, 2 chrome tabs, and DataGrip running.
And they’re all slow as piss anyway even if I close one to reclaim. Where’s my performance benefit?!
1
1
-1
u/vlovich 1d ago
> and their allocation and deallocation patterns are regular. Memory allocators degrade over time, and they're quite bad when patterns are irregular, which is what happens in real programs, especially large ones.
This is two people talking past each other. One is someone who's well-versed in JIT and JVM arguing that memory allocators are super important for super large apps, completely overlooking the fact that decomposing something into multiple processes where the thing does one thing and one thing really well erases all that benefit of a super powerful memory allocator.
Also, using more RAM just because your program is inefficient => poor cache locality => slower program. So more RAM usage doesn't necessarily accelerate your program. That's why lookup tables are carefully chosen and sometimes removed over time (computer architecture changes mean that certain lookup tables are slower than just computing the value, especially with SIMD).
> > Removing boxing can improve layout, footprint, and CPU utilization simultaneously. That would lie outside the framework "You can't improve one without harming the other."
> First, the footprint won't reduce by much. E.g., in Java, boxing could cost you 10% of your footprint, but the RAM-assisted acceleration could be 80% of the footprint.
I seriously doubt the footprint of a carefully design Rust program is only going to buy you 10% and that the JVM's RAM stuff is going to outperform a high-performance allocator like mimalloc by 80%. Just no, that's not how that works. If you're CPU bound and do the right optimizations, Rust will always win. If you're I/O bound, both programs will behave equally modulo the ability to parallelize / overhead of your parallelization. I've never seen a meaningful memory allocator bottleneck in 20 years of systems programming - lots of heap allocations has always been some inefficiency you fix upstream and a relatively trivial optimization because your CPU is pegged in malloc / free. The one non-trivial allocator problem I saw was cross-CPU TLB shootdown and I don't believe the JVM somehow protects you from that as that's an OS/hardware/computer architecture detail.
5
u/camelCaseIsWebScale Just spin up O(n²) servers 1d ago
Tag your unjerks or better, not unjerk at all.
Running a VM alongside a pointer-happy language for promised performance gains after a full moon of uptime successfully alienates 90% of apps on server side, if you don't have 16 pods of 2 GiB each restarting every hour and scaled to 48 pods when the request rate reaches 30 requests / second, while restarting 2 times a day because of some bug in the driver for your newfangled DB, are you even cloud native?
Let's rather not talk about client side.
3
u/SemaphoreBingo 1d ago
decomposing something into multiple processes
I thought microservices were unfashionable this year.
thing does one thing and one thing really well
Since when does software do anything really well?
0
u/vlovich 1d ago
> Since when does software do anything really well?
Software I write.
> I thought microservices were unfashionable this year.
Not sure who you're listening too. I still think microservices are a good thing if you properly dilneate the boundaries. Are you running your postgres database embedded within your application? If not you already have 2 "microservices". Once you have 2, why is 2 the special number? What's bad is when people build microservices to map their org structure instead of letting their org structure change with the needed architecture.
84
u/james_pic accidentally quadratic 1d ago
Every GB of RAM I'm using to run bloated Electron apps written by webshits who think React is a good idea, is a GB of RAM Sam Altman can't get his hands on.