Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For inlining in general, I think the wikipedia article is good https://en.wikipedia.org/wiki/Inline_expansion.

The reason it's so important is that inlining synergises with other optimizations, its often run before or after other passes like constant propagation. Consider something like:

  fn add(x : usize, y : usize) -> usize { x + y }

  fn main() {
    add(5, 1)
  }
Without inlining we can't easily optimize the code of `main`. However, if we inline `add` into main, constant propagation will then directly see `5 + 1` and optimize that into `6`.


I understand, thank you!




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

Search: