this post was submitted on 11 Mar 2025
588 points (96.1% liked)
Programmer Humor
21409 readers
1402 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Indeed, anytime I optimize code, it ends up taking more CPU to run.
Isn't that what you're optimising? Trying to reduce runtime by increasing CPU load
If that's a genuine non-sarcastic question that isn't whooshing me then no - there can be other things like memory/disk usage... but if I'm optimizing for CPU I want it to use less overall cycles. It may be that the easiest fix is to throw money at the problem (always a fair option) which would mean getting a beefier/more processor cores to make the performance acceptable but this would usually just shift how cycles are being used to process them faster.
My joke above was that it'd use more total cycles which actually is generally the case if you're solving a problem by throwing resources at it (since you're likely incurring more overhead) but generally when you optimize you want to reduce the total number of cycles by somehow locating and eliminating work that doesn't need to be done.
It was genuine, in my workplace the only optimisation is for run time
I once made a multithreaded code for an embedded device.
Tested it on my development Desktop PC and it used all 4 cores.
Running it on the target device, all threads ran on the same core because it was too powerful for Linux to feel the need to use multiple cores.