Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jan 2009 18:57:12 +0000 (UTC)
From:      David Schultz <das@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/lib/libc/stdio vfprintf.c vfwprintf.c
Message-ID:  <200901171857.n0HIvV5Z012361@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
das         2009-01-17 18:57:12 UTC

  FreeBSD src repository

  Modified files:
    lib/libc/stdio       vfprintf.c vfwprintf.c 
  Log:
  SVN rev 187369 on 2009-01-17 18:57:12Z by das
  
  When f[w]printf() is called on an unbuffered file like stdout, it
  sets up a fake buffered FILE and then effectively calls itself
  recursively. Unfortunately, gcc doesn't know how to do tail call
  elimination in this case, and actually makes things worse by
  inlining __sbprintf(). This means that f[w]printf() to stderr was
  allocating about 5k of stack on 64-bit platforms, much of which was
  never used.
  
  I've reorganized things to eliminate the waste. In addition to saving
  some stack space, this improves performance in my tests by anywhere
  from 5% to 17% (depending on the test) when -fstack-protector is
  enabled. I found no statistically significant performance difference
  when stack protection is turned off. (The tests redirected stderr to
  /dev/null.)
  
  Revision  Changes    Path
  1.86      +12 -7     src/lib/libc/stdio/vfprintf.c
  1.37      +11 -7     src/lib/libc/stdio/vfwprintf.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901171857.n0HIvV5Z012361>