5 questions to test your understanding
A compiler is evaluating whether to inline a tiny 3-instruction getter function that is called from 800 different locations, most of them in initialization code that runs once at startup. What should the heuristic decide?
What is the primary reason that inlining every function call in a program could make it run *slower* than selective inlining?
A function that is very small (below the compiler's size threshold) should generally be inlined, regardless of how frequently it is called.
Profile-guided optimization (PGO) improves inlining decisions by revealing which call sites execute most frequently during representative program runs.
Why do production compilers use elaborate cost models rather than a simple size threshold when deciding whether to inline a function, and what factors beyond size matter most?