Number of distinct substrings of a string [continuation]
Bearophile
bearophileHUGS at lycos.com
Sun Nov 29 08:15:14 EST 2009
n00m:
> my home tests proved Python is a fellow fast beast of C++.
> Quite unexpected (I expected Py would be by ~10 times slower).
> PS
> Both my codes are identical in their algorithms.
> =============================
> 0.016 0.0150001049042 <--- exec times
Maybe in your C++ code there's something that can be improved, this is
a 1:1 translation to D (V.1) language (using dlibs) and it's about 2.2
times faster than the Psyco version:
http://codepad.org/MQLj0ydB
Using a smarter usage of memory (that is avoiding all or most memory
allocations inside all loops), the performance difference will surely
grow.
Bye,
bearophile
More information about the Python-list
mailing list