3
akkal
7y

if a = CLEAN
b= OPTIMIZATION
Whish one is best
1) a>b
2) a<b
3) a>=b
4) a<=b

Comments
  • 4
    1 for sure, maybe 3 in some special cases, but usually always stick with clean and simple code. That's day-one shit.
  • 4
    It depends on the application
  • 2
    If others are going to see and use it, strive for clarity.
    If it's for missile guidance or something else that's time-critical, go for optimization.
    Tune those considerations for all applications in between.
  • 2
    @mhudson the issue with time critical stuff is that it's still probably got to be maintained by someone. IIRC the embedded guys I used to work with used to write their code in visual studio and then run some variety of witchcraft on it that would optimize it ahead of installation.
  • 1
    @projektaquarius sounds like the end product was optimized 😂

    Seriously though, where witchcraft is lacking, I think in reverse-YAGNI. What is most desperately needed?

    If the performance is desperately needed, I'll crack open some inline assembly to meet benchmarks (I think that's been needed all of one times in the last ~seven years)

    Clarity is really important. Really really important - but on the rare occasions where every-expletive-cycle matters, I'll sacrifice some clarity to hit benchmarks.
  • 2
    @mhudson oh most definitely. But I figure if you can write it clearly, then majick it into optimized code, do that.
Add Comment