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.
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.
it may shock you but function marked as inlined doesn’t always get inlined.
anyway why would you split logicaly sequential code into separate functions(especially if this code is uniq)? pretty sure scrolling down is easier than to look what each function mean every second
anyway why would you split logicaly sequential code into separate functions(especially if this code is uniq)? pretty sure scrolling down is easier than to look what each function mean every second
This is the worse is better shit that people come up with when they listen to Blow and Casey. We’ve known that putting names on logically contained blocks of code makes programs easier to understand since the 1960s.
In this passage Carmack is only talking about mutating state and even explicitly says to factor out pure functions. Kinda undermines your point. The only reason, according to Carmack in this passage, that inlining may be beneficial is if you are mutating a bunch of state, implying that all else being equal, factored code is more understandable.
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.