stdio performance in tango, stdlib, and perl

James Dennett jdennett at acm.org
Wed Mar 21 21:10:45 PDT 2007


Walter Bright wrote:

[snip]

> The conventional wisdom with C++ is that:
> 
> 1) C++ code is inherently faster than in any other language
> 2) iostream has a great design
> 3) iostream is uber fast because it uses templates to inline everything
> 
> Andrei's benchmark blows that out of the water. Even interpreted Perl
> beats the pants off of C++ iostreams.

This kind of simplistic bashing of a language or library
design based on testing of some unnamed implementation(s)
of that library doesn't give D a good image.  There are
other benchmarks that show C++ IOStreams beating C's
stdio on performance.  Those are also meaningless out of
context.

There are real issues with some of the design of IOStreams.
There are very real problems with many implementations of
IOStreams.  There are also good implementations that
perform pretty well, but overall IOStreams is not widely
viewed in the C++ community as "having a great design",
just as having a design that's OK, and a lot safer and
more cleanly extensible than C's stdio.

Of course C++ code isn't inherently faster than any other
language, and I've not come across anyone saying that it
is.  And one of the main problems with IOStreams is that
it makes excessive use of virtual functions in ways that
inhibit inlining, particularly in typical implementations
which drag in locale support even for programs that do
not use it.  The C++ community recognizes these problems,
and the C++ committee has addressed some of them (through
exposition) in its Technical Report on C++ performance.

I'm at a loss to understand why you would write what you
did.  It seems to be a straw man, but maybe there was
something else to it -- frustration that people assume
that D must be slower than C++?

-- James



More information about the Digitalmars-d mailing list