Is there an actual example where inline is detrimental to the performance of a C program? -


in many debates inline keyword in function declarations, point can make program slower in cases – due code explosion, if correct. have never met such example in practice myself. actual code use of inline can expected detrimental performance?

exactly 10 years , 1 day ago did commit in openbsd:

http://www.openbsd.org/cgi-bin/cvsweb/src/sys/arch/amd64/include/intr.h.diff?r1=1.3;r2=1.4

the commit message was:

deinline splraise, spllower , setsoftint. makes kernel smaller , faster. deraadt@ ok

as far remember kernel binary shrunk more 100kb , not single test case produced became slower , several macro benchmarks (like compiling kernel) measurably faster (5-10% if recall correctly, don't quote me on that).

around same time went on quest measure inline functions in openbsd kernel. found few had minimal performance gains, majority had 0 measurable impact , several making things slower , killed. @ least 1 more uninlining had huge impact , 1 internal malloc macros (where idea inline malloc if had size known @ compile time) , packet buffer allocators shrunk kernel 150kb , had significant performance improvement.

one speculate, although have no proof, because kernel large , we're struggling stay inside cache when executing system calls , every little bit helps. helped in cases shrinking of binary, not number of instructions executed.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -