String implementations

Walter Bright newshound1 at digitalmars.com
Sun Jan 20 12:27:30 PST 2008


bearophile wrote:
> The built-in sort of Python is the Timsort, that's way faster than
> the D built-in (I have written a rather simple sort that is up to 3
> times faster than the built in in D, and it's always faster no matter
> what data I use).

D's sort is in phobos/internal/qsort.d and qsort.d. If you have a faster 
qsort, and want to contribute it, please do so! Same goes for other 
faster routines you've written.

> Now and then the text I/O on disk of the current DMD is slower than
> Python, this comes from some of my benchmarks.

The D 2.0 I/O is much faster than the 1.0 I/O. But it still suffers a 
bit from the requirement (I imposed) of being compatible with C stdio. I 
don't know if Python does this or not.

> 
> I know all those parts of DMD can be improved later. When you create
> a new language you can't (and you don't want to) optimize every
> little bit (because it may be premature optimization), optimizazion
> must come later, so I understand Walter in this regard. But all this
> is just to show you that if today you have to process lot of text in
> a very flexible way it's not easy to beat the languages like Perl
> (but Python/Ruby/Tcl too. Ruby is less good than Python for Unicode
> texts, I think) designed for it.

I don't believe there are any fundamental reasons why D string 
processing should be slower, it's just spending the effort on it.



More information about the Digitalmars-d mailing list