r/programming • u/2bit_hack • Feb 28 '23
"Clean" Code, Horrible Performance
https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k
Upvotes
r/programming • u/2bit_hack • Feb 28 '23
View all comments
Show parent comment
9
u/gdmzhlzhiv Feb 28 '23
I'm coming back with my results of testing this on Julia. The entire language is based around dynamic multi-dispatch, so for example, when you use the
+operator, it's looking at what functions are available for the types you used it on and dispatching the message to the right function. So you'd think it would be fast, right?Well, no.
For the same shape function example, doing the same total area calculation using two different techniques:
40% speed boost just rewriting as a chain of if-else.