Implementing file reading in C/Python

rurpy at yahoo.com rurpy at yahoo.com
Fri Jan 9 16:33:27 CET 2009


On Jan 9, 6:48 am, Johannes Bauer <dfnsonfsdu... at gmx.de> wrote:
> mk schrieb:
> > The factor of 30 indeed does not seem right -- I have done somewhat
> > similar stuff (calculating Levenshtein distance [edit distance] on words
> > read from very large files), coded the same algorithm in pure Python and
> > C++ (using linked lists in C++) and Python version was 2.5 times slower.
>
> Yup, that was about what I had expected (and what I could well live
> with, it's a tradeoff).

The rule-of-thumb I use is that Python is generally 5 to 50 times
slower than C.  It is considered blasphemy to say it in this group,
but Python is slow.  It does of course have many compensating
advantages
that make using it advantageous when runtime speed is not of primary
importance.



More information about the Python-list mailing list