From: Linus Torvalds <torvalds@linux-foundation.org>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Shrink the git binary a bit by avoiding unnecessary inline functions
Date: Sun, 22 Jun 2008 15:40:30 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0806221532560.2926@woody.linux-foundation.org> (raw)
In-Reply-To: <vpqej6p9ko2.fsf@bauges.imag.fr>
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
prev parent reply other threads:[~2008-06-22 22:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-22 19:19 Shrink the git binary a bit by avoiding unnecessary inline functions Linus Torvalds
2008-06-22 21:32 ` Christian MICHON
2008-06-23 1:01 ` Christian MICHON
2008-06-23 4:54 ` Linus Torvalds
2008-06-23 5:26 ` Christian MICHON
2008-06-22 22:20 ` Matthieu Moy
2008-06-22 22:40 ` Linus Torvalds [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.10.0806221532560.2926@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox