Usually when I see one-line functions they cost more in short term memory than they save. There's good exceptions to this with something like a horrible conditional that is necessarily horrible so you can bust it out into a method with a doc comment about the horribleness, its history, and its subtle madness. But developers that just break out one-line methods all over the place wind up writing hard to understand code.
Beat me to it. Yes, I ran a quick benchmark[0] and not running a function always wins. now, one may argue that you are running a call, but if the interpreter was smart it would convert the small function calls to just a noops.
Summary
'Perl/nofunc' ran
1.63 ± 0.30 times faster than 'Perl/func'
1.73 ± 0.34 times faster than 'Lua/nofunc'
2.11 ± 0.55 times faster than 'Lua/func'
9.37 ± 1.62 times faster than 'Python/nofunc'
12.18 ± 1.90 times faster than 'TCL/nofunc'
16.02 ± 2.58 times faster than 'TCL/func'
18.64 ± 3.02 times faster than 'Python/func'
> A consonant will be denoted by c, a vowel by v. A list ccc... of length greater than 0 will be denoted by C, and a list vvv... of length greater than 0 will be denoted by V. Any word, or part of a word, therefore has one of the four forms:
CVCV ... C
CVCV ... V
VCVC ... C
VCVC ... V
Usually when I see one-line functions they cost more in short term memory than they save. There's good exceptions to this with something like a horrible conditional that is necessarily horrible so you can bust it out into a method with a doc comment about the horribleness, its history, and its subtle madness. But developers that just break out one-line methods all over the place wind up writing hard to understand code.