3 ms·
You could argue that it's better to make the function; the compiler will probably inline it if it's only used once, and it helps avoid having the logic duplicat
by ams6110 9y ago
You could argue that it's better to make the function; the compiler will probably inline it if it's only used once, and it helps avoid having the logic duplicated if it's needed again (or by lazy copy/paste programmers).
- wvenable 9y agoMy point is not performance but that a function used only once is likely just contributing to one conceptual block of code. But now it's artificially divided up and one has to jump around to understand that code as a whole. There are exceptions of course but blindly adding functions to avoid indenting is probably going to lead to a harder to follow solution.