Compiler Function Inlining

This cluster focuses on discussions about function inlining by compilers, its impact on performance by reducing call overhead and enabling further optimizations, and factors influencing when inlining happens or doesn't.

📉 Falling 0.5x Programming Languages
3,386
Comments
20
Years Active
5
Top Authors
#1642
Topic ID

Activity Over Time

2007
4
2008
9
2009
37
2010
64
2011
68
2012
87
2013
118
2014
198
2015
182
2016
241
2017
234
2018
202
2019
186
2020
277
2021
285
2022
332
2023
281
2024
302
2025
252
2026
27

Keywords

REP CPU JIT AFAIR SufficientlySmartCompiler r.had co.nz C11 OTOH ReleaseSafe inline function compiler functions function calls calls code ics compiled performance

Sample Comments

flohofwoe • Sep 7, 2020 • View on HN

Only if the function is inlined, at least it seems that way from experimenting on godbolt.org.

henrydark • Jul 7, 2022 • View on HN

This is like a compiler inlining code for faster performance, with exactly the same reasons

sanxiyn • Jun 22, 2017 • View on HN

Not explicitly, but because hot functions get inlined and inlining enables optimizations, something roughly similar does happen.

pcwalton • Mar 31, 2018 • View on HN

Yes, especially if callees are inlined.

comex • Jun 28, 2020 • View on HN

Function calls do none of those things if they’re inlined, and compilers have been able to inline functions for a long time. Perhaps this code is even older than that.

nightcracker • Mar 13, 2015 • View on HN

The effect you're describing can happen to any inlined function.

wallscratch • Jul 12, 2021 • View on HN

Why can inlining functions cause disasters? Just instruction cache misses, or other things as well?

wolfgang42 • Aug 29, 2017 • View on HN

Thanks for the link to the issue. I was wondering why the post was talking about function call overhead instead of being able to inline it.

maxlybbert • Mar 7, 2016 • View on HN

If the compiler doesn't inline something, you generally have no way of knowing if the reason was had good or bad.

29athrowaway • Dec 2, 2020 • View on HN

The compiler can inline things for you. There is a way to specify that a function should be inlined: inline.https://en.cppreference.com/w/cpp/language/inlineIf this specifier is used, then when your inlined function is compiled there will be no function call, just the inlined code.This is just a hint for the compiler, though. The compiler can ignore