This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to suggest putc/fputs over printf("string") or printf("\n")


On Sun, Jan 10, 1999 at 01:17:45AM -0700, Jeffrey A Law wrote:
> Actually, I'd consider a patch which conditionally converted them for the
> user.    We've kicked that idea around quite a bit inside Cygnus, but never
> got excited enough to implement it.  See also:
> 
> http://www.nullstone.com/htmls/category/printf.htm

Bear in mind, that most of these optimisations (if not all) tend to make
programs larger.  So they aren't always desirable.

- putc is almost always larger than printf, though much faster.

- puts requires separate library code, when just printf would have done.
  Often, the calling sequence is the same for both.

- Splitting printf("foo %s", str) into two function calls will almost always
  result in larger code.

-- Jamie


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]