Hacker News new | comments | show | ask | jobs | submit login
How Inlined Code Makes for Confusing Profiles (psy-lob-saw.blogspot.com)
27 points by matthewwarren 3 months ago | hide | past | web | favorite | 3 comments



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…


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?


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.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: