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?> To get portability and most of the performance I plan to look at unbuffered > stdio.Buffering is goodness, no? -Chris -- http://nondot.org/sabre/ http://llvm.org/
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
On Fri, 17 Aug 2007, David Greene wrote:>> 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 directlyWindows has POSIX calls.> 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.I don't think open/write etc are POSIX. Windows has them but you have to use different headers etc to get access to them. I am no expert in this area though.>>> 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.I'm not suggesting using iostreams. I'm suggesting using FILE*'s directly.> 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.I agree. -Chris -- http://nondot.org/sabre/ http://llvm.org/