Hacker News new | past | comments | ask | show | jobs | submit login

Yup, you always have to measure.

Though my impression is that compilers tend to be fairly conservative about inlining so that don't risk the inlining being a pessimization.




My experience has been that it's rather heuristic based. It's a clear win when you can immediately see far enough in advance to know that it'll also decrease the amount of generated code. You can spot trivial cases where this is true at the point of inlining. However, if you stopped there, you'd leave a ton of optimizations on the table. Further optimization (e.g. DCE) will often drastically reduce code size from the inlining, but it's hard to predict in relationship to a specific inlining decision.

So, statistics and heuristics.


In my experience it's the "force inline" directives that can make this terrible.

I had a coworker who loved "force inline". A symptom was stupidly long codegen times on MSVC.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: