Top 5

Benji Smith dlanguage at benjismith.net
Fri Oct 10 23:59:17 PDT 2008


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: StringTest.java
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20081011/1dc83e15/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: StringTest.d
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20081011/1dc83e15/attachment-0001.ksh>


More information about the Digitalmars-d mailing list