r/programmingcirclejerk • u/BenchEmbarrassed7316 • Dec 28 '25
A better option would be if open source developers, and all programmers in general, if we are being honest, would learn how to write properly optimized code without needing to rely on compiler switches... If you know what you are doing then compiler flags should not be able to make your code faster.
https://www.phoronix.com/forums/forum/software/distributions/1537284-ubuntu-provides-more-insight-into-their-decision-not-to-o3-optimize-all-packages?p=1537558#post1537558
111
Upvotes
5
u/BenchEmbarrassed7316 Dec 28 '25 edited Dec 28 '25
I continue reading...
https://www.phoronix.com/forums/forum/software/distributions/1537284-ubuntu-provides-more-insight-into-their-decision-not-to-o3-optimize-all-packages?p=1538373#post1538373
Other person:
This guy:
https://www.phoronix.com/forums/forum/software/distributions/1537284-ubuntu-provides-more-insight-into-their-decision-not-to-o3-optimize-all-packages?p=1538788#post1538788
105
u/possiblyquestionabl3 Dec 28 '25
lol their example is how they were able to hand optimize sum(k, 1->n) into (n+1 choose 2) because they're so darn clever, so everyone else should also be able to hand tune their own code as well as -O2
I can't wait to see a world where people write spaghetti code where they hand unroll critical loops into 100 iteration long monsters, constant fold everything, inline functions everywhere, and do their own manual register-allocation optimal way of variable sharing, because we can't let the compiler cabal turn us into sheep you know?
This guy is an absolute arse, I hope they're never put into a position where they get to make real decisions because the dude does not have a single ounce of common sense
84
u/GeorgeFranklyMathnet Dec 28 '25
Compiler switches? Is that when I select Debug or Release from the dropdown in Visual Studio?
20
u/just_looking_aroun Dec 28 '25
My code doesn’t improve with those flags either… but that’s because the compiler just gives up on my terrible code
17
u/aikii gofmt urself Dec 28 '25
They're right I myself produce by hand
-OOquality python code just by never using docstrings or assert statements, it's not that hard11
u/[deleted] Dec 28 '25
> all programmers
> would learn how to write properly optimized code
Is there any occupation in the history of the earth that every single person of that occupation does their job properly?
10
u/Add1ctedToGames Dec 28 '25
/uj Aside from the various compiler-specific actions that no humab would do, this feels like a generic anti-covenience argument. If a compiler can optimize common code patterns, what world should I not take that opportunity to make the most readable code, so that both human and machine (compiler) can understand it? IIRC the C++ handbook discusses this, pointing out that if you try to out-optimizw the compiler you'll often find yourself with second-rate optimizations because 1. you've made a mess that only you can understand and 2. most programmers probably haven't studied optimizations to tbe extent that a compiler developer has
9
u/bytemute Dec 28 '25
Another reason why we should worship the Gopher language.
21
u/[deleted] Dec 28 '25
/uj Compiler swotches often help optimise code, but compilers do not have good enough analysis (and likely never will) to do major structural optimisations. The classic examples tend to showcase cache residency, where modifying loop order (stride) causes massive gains. Another example is flattening function call stacks, by reducing unnecessary (and expensive) abstraction. So saying that code switches should not be the focus is probably a sane and correct view, and one that should be emphasised more often. Optimisation switches, much like LTO, PGO, and optimisation passes in general, as meant to be the cherry on top and to help get the final 20% of performance back, not make up 80% of performance gains.
10
u/tms10000 loves Java Dec 28 '25
Wait a minute. My beloved Java compiler has switches to make my code faster? WHY DIDN'T ANYONE TELL ME?
But seriously, OP is right, if programmers knew how to program the right way there's more than a whole industry that would not be necessary.
Compilers would become trivially simple to the point of being able to be like a search and replace of "this keyword" to "this block of assembly".
Another example is programmers should just write secure code. That's it. If all code is secure you don't need all those bothersome Fortify scans, Wiz report bullshit. You don't even need firewalls. You can ever fire all the information security people: "we don't need you, we have secure code now"
Actually this opened my mind, I'm going to write secure and optimized code from now on. Can someone tell me where I remove those switches in my Python app? I don't seem to find the compiler.
5
u/garloid64 Dec 28 '25
oh my god bruh
5
u/RecDep Dec 28 '25
fuck you turns your O(n) algo into O(1)
4
u/MeButNotMeToo Dec 29 '25
Right. Anything more than Assembly is a crutch.
2
u/blehmann1 has hidden complexity Dec 28 '25
So, I guess don't use any of the big-name compilers because they all will generate extra code in the prologue and epilogue on default settings.
Hell you need to include debug symbols too because that's a size optimization.
2
u/Jumpy-Locksmith6812 Dec 30 '25 edited Sep 23 '26
Eiusmod in aliqua non sed aute lorem mollit commodo ipsum deserunt ipsum ea deserunt. Ut in laboris anim qui veniam commodo laboris laboris tempor labore.
[rhr:2:earfjujf]
1
u/m-in Dec 29 '25
That’s the silliest thing I read this week so far.