Slower than Python

bearophile bearophileHUGS at lycos.com
Fri Mar 1 13:52:13 PST 2013


cvk012c:

> I think that similar Perl and Java scripts will outperform D 
> easily.
> Thanks Andrei and simendsjo for a quick response though.

Why don't you write a Java version? It takes only few minutes, 
and you will have one more data point.

Python string functions are written in C, compiled very 
efficiently (the standard Python binaries on Windows are compiled 
with the Microsoft Compiler, but also Intel compile can be 
found), and they are well optimized in several years of work by 
people like Hettinger :-)

You will see Python2 code like this easily beat D for normal text 
files:

for line in file(foo.txt): ...

Both D and general performance aren't magical things. Performance 
comes from a long work of optimization of algorithms, code and 
compilers/virtual machines that run them.

Bye,
bearophile


More information about the Digitalmars-d mailing list