Why Strings as Classes?

Fawzi Mohamed fmohamed at mac.com
Tue Aug 26 22:21:23 PDT 2008


On 2008-08-26 14:15:28 +0200, bearophile <bearophileHUGS at lycos.com> said:

> [...]
> In my site I am keeping a gallery of tiny benchmarks where D code (with 
> DMD) is 10 or more times slower than very equivalent Python, C, Java 
> code (I have about 12 programs so far, very different from each other. 
> There's a benchmark regarding the associative arrays too). Hopefully it 
> will become useful once people will start tuning D implementations.
> 
> Bye,
> bearophile

You know I have got the impression that you have a naive view of 
datastructures, and each time you find a performance problem you ask 
for the data structure to be improved.
One cannot expect to have a single data structure accomodate all uses, 
simply because something is a container, and support a given operation 
it does not mean that it does support it efficiently.
*if* something is slow for a given purpose what I do is to sit down a 
think a little which datastructure is optimal for my problem, and then 
switch to it (maybe taking it from tango containers).

Don't get me wrong, it is useful to know which usage patterns give 
performance problems with the default data structures, and if 
associative arrays would use a tree or some sorted structure for small 
sizes (avoiding the cost of hashing) I would not complain, but I do not 
think (for example) that arrays should necessarily be very optimized 
for appending...

Fawzi




More information about the Digitalmars-d mailing list