gcc - What are good heuristics for inlining functions? -


Keeping in mind that you are trying to optimize for speed, to decide What is good uplift for whether or not to inline the function? Obviously the size of the code should be important, but any other factor is usually used when (say) is the GCC or the ICC setting in order to inline a function call? Is there any significant academic work in this field?

Wikipedia has paragraphs about it, which have some links below:

Ul>

  • In addition to memory size and cache problems, from the perspective of the compiler, the variable added to the inlineated process can consume additional registers, and in that area where the registration pressure is already higher, it forces the spilling , Which makes the use of additional RAM. "
  • Languages ​​with JIT compiler and Runtime class loading are other tradeoffs because the virtual methods are not known statically, even though JIT can collect runtime profiling information, such as method call frequency: < / P>

    • (for Java) Talks about static methods and methods of dynamically loaded sections and its improvements on performance.

    • Claims that their "inlineing policy is based on code size and outline. If the method of execution of a method entry is below a certain limit, then the method is not inline Because it is considered as a cold method. To avoid the code explosion, we do not inline a method with a biometric size of more than 25 bytes ... to avoid inlining with a deep call tea N, inlineing It is, when the inline bitecode size accumulated with the call series is more than 40 bytes. "Although they have runtime profiling information (method call frequency), they can still prevent bloat by inlining the chain of large functions or functions Be careful to avoid

    • Li>
        < Li>

        In the compiler's design there is a chapter about Statistical and Machine Learning Technique, with the help of Hurricanes, to set different parameters, the outline of the results refers to this chapter Vasani et al-paper, where they "compile optimization Theorem Modeling Techniques for Creating Micro Architectural Sensory Models Using the proposed ".

      • (Some other books talk about programmers' views, such as the dangers of inline work, and often about differences between inlining and macros. Compiler often ignores programmers' inline requests if they can determine that they will do more harm than good, it may be overridden with macros as the last resort.)


    Comments

    Popular posts from this blog

    oracle - The fastest way to check if some records in a database table? -

    php - multilevel menu with multilevel array -

    jQuery UI: Datepicker month format -