On Wed, 15 Aug 2007, David Greene wrote:> I was just about to say that. While debugging my custom streambuf I had the > "opportunity" of investigating how libstdc++-v3 defines cout and friends. > It's not pretty. Basically, there's a stdio_sync_filebuf used as a proxy to > C's FILE *. Because stdio_sync_filebuf does no buffering itself (delegating > that to FILE), basic_streambuf::overflow is called a lot. Some of this is > mitigated with xsputn for multiple characters, but it's a lot of virtual > function calls.Yes, it is extremely inefficient.> To get something faster probably means a custom buffering solution (which > my custom streambuf has, but is not particularly intelligent) and native > syscalls. The downside of my implementation is that it is POSIX-specific > and thus won't be real useful for Windows.Why not just use the unlocked stdio calls? -Chris -- http://nondot.org/sabre/ http://llvm.org/
On Wednesday 15 August 2007 15:55, Chris Lattner wrote:> > To get something faster probably means a custom buffering solution (which > > my custom streambuf has, but is not particularly intelligent) and native > > syscalls. The downside of my implementation is that it is POSIX-specific > > and thus won't be real useful for Windows. > > Why not just use the unlocked stdio calls?Because I'm lazy. :) No, seriously, because I just haven't had time to do it. And because I'm lazy. If/when I submit this to LLVM I'll look at going that route. As for now, I just have to get something working for our needs here. -Dave
On Wed, 15 Aug 2007, David A. Greene wrote:>>> and thus won't be real useful for Windows. >> >> Why not just use the unlocked stdio calls? > > Because I'm lazy. :)It seems much easier to use a robust and well tested system than invent a new crazy scheme ;-)> No, seriously, because I just haven't had time to do it. And because I'm > lazy. If/when I submit this to LLVM I'll look at going that route. As for > now, I just have to get something working for our needs here.ok! -Chris -- http://nondot.org/sabre/ http://llvm.org/