[LLVMdev] Extending AsmPrinter

David Greene dag at cray.com
Fri Aug 17 10:04:30 PDT 2007


On Thursday 16 August 2007 17:59, Chris Lattner wrote:
> On Thu, 16 Aug 2007, David Greene wrote:
> > Actually, there's another reason not to use unlocked calls.  They require
> > POSIX compliance.
>
> Posix is pretty available, what system doesn't have them?

Windows, for one.  If POSIX is ok, it's better in my mind to just directly
use open, write and friends, which is what I do now.  Going the cstdio
route should only be done for portability reasons to support non-POSIX
systems.

> > To get portability and most of the performance I plan to look at
> > unbuffered stdio.
>
> Buffering is goodness, no?

Buffering is goodness.  The problem with using buffered cstdio under
iostreams is that you have to go through overflow() and/or xsputn() to send
data to cstdio.  These are virtual calls and they will be more frequent
because there's no buffering at the iostreams level.  It seems wasteful 
to do buffering at two different levels so I'd say it's better to do it before
the virtual calls happen, for performance reasons.

                                              -Dave



More information about the llvm-dev mailing list