WordCount performance

Jason House jason.james.house at gmail.com
Wed Mar 26 16:12:25 PDT 2008


Frits van Bommel wrote:

> bearophile wrote:
>> To test it, I have used a 7.5 MB file of real text. The C version
>> (compiled with MinGW 4.2.1) is ~7.8 times faster (0.43 s instead of 3.35
>> s) than that very simpler code compiled with DMD (1.028). If I use a
>> named break in the D code (that OUTER), to avoid the goto, the running
>> speed is essentially the same. On a 50 MB file of text the timings are
>> 2.43 s and 20.74 s (C version 8.5+ times faster).
> 
> The first thing that comes to mind: "For the Nth time, someone thinks
> language X is 'faster' than language Y because of a comparison between
> compilers with completely different backends (and thus optimizers), even
> though there are pairs of compilers that use the same backend for either
> language."
> 
> Try comparing DMC vs. DMD, or GCC vs. GDC...

I have a D program that's an AI engine.  It competes against programs
written in other languages and with different compilers.  Speed matters to
me, regardless of which compiler my competition uses.

One of my attractions to D (besides all the cool features) was that it
compiled to native assembly like C++.  I implicitly assumed I'd be getting
C++ (speed) without the warts.  When performance gaps are an order of
magitude, the D language seems like a horrible choice.  I've thought on
more than one occasion about going back to C++ or Java for the speed.



More information about the Digitalmars-d mailing list