4 ms·
Force inlining code is actually quite a useful optimisation still. We have found many instances that after a few inline functions the compiler gives up and just
by daemin 7y ago
Force inlining code is actually quite a useful optimisation still. We have found many instances that after a few inline functions the compiler gives up and just calls the function instead. Force inlining certain low level functions has actually improved performance by several percent in our codebase.
- Buge 7y agoFrom the language standpoint, the inline specifier doesn't force the compiler to inline the function. But I guess some compilers could provide guarantees that go beyond what the spec says.
- daemin 7y agoI was talking about __forceinline for MSVC and things like it for other compilers. One's which for better or worse will make your function inlined. One thing that I did find out what that even if you inline or force inline a function, that if you have it exported from a DLL or in a class that is exported as a DLL, then the function might still be called non-inline.