inlining

Pankaj Mehta mehta.pankaj at gmail.com
Sat Feb 15 00:00:24 UTC 2014


These should be covered during the link time optimisations.

Look here for gcc: http://gcc.gnu.org/wiki/LinkTimeOptimization

And here for Visual Studio :
http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx

Cheers
Pankaj


On 14 February 2014 23:24, atarob <nginx-forum at nginx.us> wrote:

> > On Friday, February 14, 2014 04:59:26 PM atarob wrote:
> > > Looking through the codebase, I see a lot of very short helper like
> > > functions that are defined in .c files with prototypes in .h files.
> > This
> > > means that the compiler cannot inline them outside of that .c file.
> > > Am I
> > > wrong?  How is that not a performance hit?
>
> > I suppose they will be inlined at -O2 level:
> > http://linux.die.net/man/1/gcc
> >
>
> Think about it. -O2 is a compiler flag. Optimization happens at compile
> time. NOT at link time. If the function is defined in another .c file, how
> can the compiler, which compiles on .c file at a time, possibly have access
> to the definition, let alone inline it. That's why we put inline function
> that are supposed to be called by other .c files in a .h file. Am I wrong?
>
> Ata.
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,247575,247582#msg-247582
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140215/1957b9f1/attachment.html>


More information about the nginx mailing list