This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New attribute "infrequent"?
- To: torvalds at transmeta dot com (Linus Torvalds)
- Subject: Re: New attribute "infrequent"?
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Mon, 27 Aug 2001 15:10:45 -0700 (PDT)
- Cc: mrs at windriver dot com, gcc at gcc dot gnu dot org
Linus writes:
> Almost always, the programmer knows which parts of his programs are
> really performance-critical. Having him/her mark _those_ parts (as
> opposed to the bulk of his program) makes much more sense than trying to
> say "this should be optimized for size" all over the place.
I agree that a "frequent" directive is better than an "infrequent"
directive, because there is a lot less code in the former category.
But in my experience, except for applications like DSP where control flow is
extremely predictable, most programmers (as opposed to gurus, and even
gurus are imperfect) tend NOT to know, or to guess wrong, about the
performance-critical parts of their program, unless they've profiled it.
Originally Fortran had a FREQUENCY statement. While I can't find definite
confirmation, the widely reported story is that IBM implemented it
backwards in their Fortran II compiler, and no one noticed for quite some
time. So it got dropped.