Re: Shrink the git binary a bit by avoiding unnecessary inline functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 23 Jun 2008, Matthieu Moy wrote:
> 
> Wouldn't it be better to split that kind of function into two parts:
> 
> - inline the short common case
> - put the special case apart

It's almost certainly not worth it. These things really aren't big 
optimization wins, and the *big* wins from doing inlines are if it allows 
the call-site to do more optimizations (eg conditionals or calculations 
that just go away if inlined with constant arguments, for example), or if 
the lack of any function call at all allows the caller to do better 
register allocation around it.

Since these inlines contain a real call regardless, the second case never 
happens.

The first case can happen with things like "strlen()" being optimized away 
for constant-sized arguments, but for the one user where that was 
(xstrdup()) it really wasn't an issue. And while a constant size argument 
to "xmalloc()" is not unlikely, and would allow the compiler to optimize 
the

	if (!ret && !size)
		ret = malloc(1);

away statically as an inline, it's really not a big win.

		Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux