Skip to content

Instantly share code, notes, and snippets.

@rjenkins
Created January 26, 2016 18:26
Show Gist options
  • Save rjenkins/141cb3fa5ae129dae3a1 to your computer and use it in GitHub Desktop.
Save rjenkins/141cb3fa5ae129dae3a1 to your computer and use it in GitHub Desktop.
The basic decisions about whether to inline a method depends on how hot it is and its size. The JVM determines if a method is hot (i.e., called frequently) based on an internal calculation; it is not directly subject to any tunable parameters. If a method is eligible for inlining because it is called frequently, then it will be inlined only if its bytecode size is less than 325 bytes (or whatever is specified as the -XX:MaxFreqInlineSize=N flag). Otherwise, it is eligible for inlining only if it is small: less than 35 bytes (or whatever is specified as the -XX:MaxInlineSize=N flag).
One often overlooked aspect of this relationship is that setting the MaxInlineSize value higher than 35 means that a method might be inlined when it is first called. However if the method is called frequently — in which case its performance matters much more — then it will likely be inlined eventually (assuming its size is less than 325 bytes). The net effect of tuning the MaxInlineSize flag is that it might reduce the warm-up time needed for a test, but it is unlikely that it will have a big impact on a long-running application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment