Re: inline considered harmful

Ervin Németh <[email protected]>
Newsgroups gmane.linux.gentoo.performance
Organization NIIF <http://www.niif.hu/>
Message-ID <[email protected]>
Mario Domenech Goulart wrote:
> There's an interesting discussion in the OpenBSD mailing
> list about the use of inline.

There is no such thing as "best optimization". Some optimization 
techniques tend to show better performance on the average, but given a 
specific code, the same technique can fail dramatically.

Inlining makes the code faster if the called function is small 
(preferably smaller than a cache-line), and called only a few times. No 
inlining will result in faster code if the function is large (at least 
one complete cache-line is used), and that function has a good chance to 
be already in the cache when called.

Also inlined functions allow the block-reordering code to do interesting 
things. Block-reordering was introduced in gcc3, BSDs are using 
gcc-2.95, AFAIK.

So far the facts.

Now the manual says that for gcc the inline-limit is 600 bytes, compared 
to the 32-128 byte cache line size of the x86 CPUs. It could be worth to 
try lower numbers with inline-functions...


/Ervin

--
[email protected] mailing list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.