where python is slower?

Bjorn Pettersen BPettersen at NAREX.com
Wed Feb 5 17:01:26 EST 2003


> From: Enrique Palomo [mailto:enrique.palomo at xgs-spain.com]
> 
> Hello all.
> 
> At job, i must work with great size text files (up to 2 Gb)
> I use python cause of its facility to work with strings.
> But python is slower than others programming languages.
[...]

I seriously doubt that you'll see any significant speed difference in
file reading/string manipulation in Python vs. eg. C. (note, I'm not
saying you can't write it faster in C, I'm saying it is non-trivial.)

Profile your Python code first, then improve your algorithms. From
personal experience, the biggest speedup you'll get is from reading in
appropriately sized chunks of the file at a time. For my system here
that's right around 150K. (And in case you care, I regularly work with
6-20G files here :-)

-- bjorn





More information about the Python-list mailing list