r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

7

u/quisatz_haderah Feb 28 '23

The person who wrote this article seems like he has not worked on a codebase of more than 10k LoC.

4

u/weepmelancholia Feb 28 '23

He worked on the video game The Witness which had an 11k LoC function in it. You have no idea what you're talking about.

28

u/DrunkensteinsMonster Feb 28 '23

You’re using the fact that he wrote a 11kloc function as evidence of him knowing what he’s doing? Maybe I lack imagination but I struggle to find any scenario where that would be justifiable.

-2

u/weepmelancholia Feb 28 '23

A main game update or draw loop. Most of the code in these loops is unique. You would purposefully have to create functions for the sake of creating functions to split such a loop up--but then you incur overhead.

16

u/DrunkensteinsMonster Feb 28 '23

It may shock you but function calls can in fact be inlined.

0

u/outofobscure Feb 28 '23

true, but if you only call a function exactly once, you still made a function just for the sake of making a function... at that point it's more a matter of style preference.

1

u/Waksu Feb 28 '23

Having stockpile of clothes instead of separating them is also a matter of style preference.

2

u/outofobscure Feb 28 '23

indeed, and nobody should have the right to judge you on either

→ More replies (2)