Inline Expansion - Problems

Problems

Replacing a call site with an expanded function body can worsen performance in several ways :

  • In applications where code size is more important than speed, such as many embedded systems, inlining is usually disadvantageous except for very small functions, such as trivial mutator methods.
  • The increase in code size may cause a small, critical section of code to no longer fit in the cache, causing cache misses and slowdown.
  • The added variables from the inlined procedure may consume additional registers, and in an area where register pressure is already high this may force spilling, which causes additional RAM accesses.
  • A language specification may allow a program to make additional assumptions about arguments to procedures that it can no longer make after the procedure is inlined.
  • If code size is increased too much, resource constraints such as RAM size may be exceeded, leading to programs that either cannot be run or that cause thrashing. Today, this is unlikely to be an issue with desktop or server computers except with very aggressive inlining, but it can still be an issue for embedded systems.

Typically, compiler developers keep these issues in mind, and incorporate heuristics into their compilers that choose which functions to inline so as to improve performance, rather than worsening it, in most cases.

Read more about this topic:  Inline Expansion

Famous quotes containing the word problems:

    There is an enormous chasm between the relatively rich and powerful people who make decisions in government, business, and finance and our poorer neighbors who must depend on these decisions to alleviate the problems caused by their lack of power and influence.
    Jimmy Carter (James Earl Carter, Jr.)

    I respect guilt. It is a dangerous but sometimes useful beast. The guilt that made me want to solve all my children’s problems meant trouble. The guilt that made me question my role in our mother-daughter squabbles proved helpful. Yes, I care about my kids’ problems, and I long to make suggestions. But these days I wait for children to ask for help, and I give it sparingly. Some things can’t be fixed, and I tell them so.
    Susan Ferraro (20th century)

    Currently, U.S. society has been encouraged by its political and subsidized mass-media intelligentsia to view U.S. life as a continual “morning in America” paradise, where the only social problems occur in the inner cities. Psychologists call this denial.
    Ishmael Reed (b. 1938)