Top 5

Denis Koroskin 2korden at gmail.com
Sat Oct 11 03:56:09 PDT 2008


On Sat, 11 Oct 2008 10:59:17 +0400, Benji Smith <dlanguage at benjismith.net>  
wrote:

> dsimcha wrote:
>> == Quote from Benji Smith (dlanguage at benjismith.net)'s article
>>> Anyhow, I'm not going to keep chasing this point. For people new to D,
>>> the subtle differences between static and dynamic arrays can be a  
>>> source
>>> of confusion. I still have my share of gotcha moments with them, and I
>>> think D would be well served by minimizing those differences.
>>> --benji
>>
>> I disagree, not only specifically on this issue but on a more  
>> philosophical level
>> about a lot of stuff that's been mentioned here in the past few days  
>> about
>> simplifying D.  The fact is that D is a performance language that  
>> retains the
>> ability to program close to the metal.
>
> Actually, when it comes to string processing, D is decidedly *not* a
> "performance language".
>
> Compared to...say...Java (which gets a bum rap around here for being
> slow), D is nothing special when it comes to string processing speed.
>
> I've attached a couple of benchmarks, implemented in both Java and D
> (the "shakespeare.txt" file I'm benchmarking against is from the
> Gutenburg project. It's about 5 MB, and you can grab it from here:
> http://www.gutenberg.org/dirs/etext94/shaks12.txt )
>
> In some of those benchmarks, D is slightly faster. In some of them, Java
> is a lot faster. Overall, on my machine, the D code runs in about 12.5
> seconds, and the Java code runs in about 2.5 seconds.
>
> Keep in mind, all java characters are two-bytes wide. And you can't
> access a character directly. You have to retrieve it from the String
> object, using the charAt() method. And splitting a string creates a new
> object for every fragment.
>
> I admire the goal in D to be a performance language, but it drives me
> crazy when people use performance as justification for an inferior
> design, when other languages that use the superior design also
> accomplish superior performance.
>
> --benji

I bet most of the performace is ate by ~= (both you and Tango routines you  
use use it extensively).



More information about the Digitalmars-d mailing list