Casey’s video is interesting, but his example is framed as moving from 35 cycles/object to 24 cycles/object being a 1.5x speedup.
Another way to look at this is, it’s a 12-cycle speedup per object.
If you’re writing a shader or a physics sim this is a massive difference.
If you’re building typical business software, it isn’t; that 10,000-line monster method does crop up, and it’s a maintenance disaster.
I think extracting “clean code principles lead to a 50% cost increase” is a message that needs taking with a degree of context.
It would be interesting to see if an iterator instead of a manual for loop would increase the performance of the base case.
My guess is not, because the compiler should know they are equivalent, but would be interesting to check anyway.
Did author knows about difference between static and dynamic dispatch? 🤦🏻♂️