News for hackers. Stuff that matters.
Re:Push Ifs Up and Fors Down by Mystery-Machine on Saturday May 17, 2025 @10:18AM (#44014506)
Terrible advice. It's the exact opposite of "Tell, don't ask".

Performance of an if-statement and for-loop are negligent. That's not the bottleneck of your app. If you're building something that needs to be highly performant, sure. But that's not the majority.

https://martinfowler.com/bliki/TellDontAsk.html

Re:Push Ifs Up and Fors Down by eapriv on Saturday May 17, 2025 @10:48AM (#44014718)
Performance of any given CPU instruction is negligible, yet somehow they accumulate to noticeable values.
Re:Push Ifs Up and Fors Down by drob518 on Saturday May 17, 2025 @12:00PM (#44015208)
Amen.
Re:Push Ifs Up and Fors Down by achernik on Saturday May 17, 2025 @10:41AM (#44014670)
consider his another post in somewhat similar spirit: https://tigerbeetle.com/blog/2024-12-19-enum-of-arrays/ the author is indeed working in a performance-oriented niche
Re:Push Ifs Up and Fors Down by hello_computer on Saturday May 17, 2025 @11:57AM (#44015193)
He’s giving object oriented design the medal for cache locality’s victory.