
How Inlined Code Makes for Confusing Profiles - matthewwarren
http://psy-lob-saw.blogspot.com/2018/07/how-inlined-code-confusing-profiles.html
======
saagarjha
Took me a while to realize that this was for Java. As JIT gets better, all the
issues that come with optimizing compilers for native languages will start
cropping up here as well…

------
Traubenfuchs
What happens if there is a long chain of different, tiny methods going from,
say, 0 to 100? I guess the last, method number 100, the "leaf method" gets
inlined in method number 99. Then we have a version of method number 99 with a
method number 100 inlined. Now what happens to method 98? Does it inline the
version of method 99 that has inlined method 100? When does it stop? Do we end
up with a huge method 0 that has all subsequent calls inlined or did I
completely misunderstood inlining?

~~~
CJefferson
The answer to "how does it stop" is a whole bunch of heuristics. Modern C++
compilers can often be seen inlining 6 or 7 levels on a regular basis. Often
these functions compile away to almost no code.

