What does 'inline' mean?

Walter Bright newshound2 at digitalmars.com
Tue Jun 9 08:33:27 UTC 2020


On 6/8/2020 5:35 AM, Jan Hönig wrote:
> In C++, consider an []operator. There would be a lot of function calls inside a 
> kernel (some function with lot of loops, one billion iterations of the inner 
> most loop easily). If then I have some kind of stencil or any array accesses, 
> calling a function each time a top of resolving the current pointer would be 
> very costly.

I infer what you're talking about is functions that are "strongly connected" 
should be located near each other in memory so they'll both be in the cache at 
the same time.

The best way to achieve this is by runtime profiling, and using the profiling 
data to group together strongly connected function in the executable. The 
Digital Mars C/C++ compiler would do this, and it was a nice optimization.

Trying to do it by hand isn't likely to be very effective.


More information about the Digitalmars-d mailing list