From: David Gordon Hogan <dhog@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] plan or side effect
Date: Thu, 28 Feb 2002 12:41:59 -0500 [thread overview]
Message-ID: <a442ebf30a1d20fab1368f02a68bab3f@plan9.bell-labs.com> (raw)
> No, in general GCC does not have such knowledge.
>
> If it is able to inline the function, then of course it can do the
> optimization, but an inlined function isn't a function call at all, so
> that's really a different case.
>
> Also, GCC has some builtin functions; it knows the behavior of those.
> But not (in general) library functions.
It certainly knows about strcpy() and memmove() (or
whatever they're #defined to in the headers). So for
instance,
strcpy(s, "xyzzy");
will get replaced with a bunch of instructions to store the
appropriate constant values in s.
I'm just reporting, I don't think it's a particularly good thing.
Like, do we really need that extra .1% speed improvement,
at the expense of code size, compile speed, and transparent
behaviour?
When I say .1%, I'm just pulling a number out of the air.
Clearly, if your program is composed entirely out of
strcpy's of constants, the improvement could be much
larger(!). But, I claim that this is a pathological case,
and the time wasted on such `improvements' is generally
better spent elsewhere (like, maybe, some day, someone
will simplify the morass of #ifdefs that GCC and Binutils
are afflicted with...).
next reply other threads:[~2002-02-28 17:41 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-28 17:41 David Gordon Hogan [this message]
2002-03-01 10:02 ` Thomas Bushnell, BSG
2002-03-01 12:07 ` Boyd Roberts
2002-03-04 10:04 ` Thomas Bushnell, BSG
2002-03-04 17:11 ` Sean Quinlan
2002-03-04 18:23 ` ozan s yigit
2002-03-05 9:41 ` Thomas Bushnell, BSG
2002-03-05 9:56 ` Boyd Roberts
2002-03-05 9:43 ` Boyd Roberts
2002-03-08 17:30 ` Thomas Bushnell, BSG
2002-03-08 18:00 ` Dan Cross
2002-03-11 10:04 ` Ralph Corderoy
2002-03-11 10:04 ` Thomas Bushnell, BSG
2002-03-14 9:56 ` macro fun [Re: [9fans] plan or side effect] ozan s. yigit
2002-03-15 10:18 ` Thomas Bushnell, BSG
2002-03-15 10:18 ` Douglas A. Gwyn
2002-03-15 17:48 ` ozan s. yigit
2002-03-15 18:40 ` Mike Haertel
2002-03-18 10:38 ` ozan s yigit
2002-03-15 18:42 ` Mike Haertel
2002-03-18 10:32 ` Thomas Bushnell, BSG
2002-03-18 10:33 ` Thomas Bushnell, BSG
2002-03-21 11:01 ` ozan s yigit
2002-03-18 10:33 ` Ralph Corderoy
2002-03-19 9:49 ` Douglas A. Gwyn
2002-03-21 11:01 ` Ralph Corderoy
2002-03-18 10:38 ` AMSRL-CI-CN
2002-03-20 13:38 ` Boyd Roberts
2002-03-18 10:38 ` ozan s. yigit
2002-03-18 13:08 ` Wladimir Mutel
2002-03-19 9:49 ` ozan s. yigit
2002-03-19 9:49 ` Douglas A. Gwyn
2002-03-19 16:01 ` ozan s yigit
2002-03-01 11:57 ` [9fans] plan or side effect Boyd Roberts
-- strict thread matches above, loose matches on Subject: below --
2002-03-08 19:22 forsyth
2002-03-07 13:45 rob pike
2002-03-07 15:47 ` AMSRL-CI-C
2002-03-06 10:24 geoff
2002-03-07 9:56 ` Douglas A. Gwyn
2002-03-05 9:54 Fco.J.Ballesteros
2002-03-06 9:51 ` Thomas Bushnell, BSG
2002-03-06 9:52 ` Douglas A. Gwyn
2002-03-08 9:59 ` ozan s. yigit
2002-03-01 11:35 forsyth
2002-02-27 15:08 presotto
2002-02-27 15:27 ` Sean Quinlan
2002-02-28 9:58 ` Thomas Bushnell, BSG
2002-02-28 12:51 ` Ralph Corderoy
2002-02-28 16:57 ` Thomas Bushnell, BSG
2002-02-28 16:01 ` AMSRL-CI-CN
2002-02-28 16:52 ` Thomas Bushnell, BSG
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=a442ebf30a1d20fab1368f02a68bab3f@plan9.bell-labs.com \
--to=dhog@plan9.bell-labs.com \
--cc=9fans@cse.psu.edu \
/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;
as well as URLs for NNTP newsgroup(s).