where python is slower?

Alan Morgan amorgan at Xenon.Stanford.EDU
Wed Feb 5 19:57:36 CET 2003


In article <mailman.1044449190.18425.python-list at python.org>,
Enrique Palomo <enrique.palomo at xgs-spain.com> wrote:

>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.

Have you actually verified this or are you just guessing?  Python
usually doesn't win speed contests with other languages, but that
doesn't mean that it will actually be slower for your particular
problem.

If, OTOH, you have actually compared the python solution with solutions
written in other languages then I have to wonder why you aren't using
one of the solutions written in another language.  :-)

>It´s not, by the moment, a big problem, but i would like to speed up the
>code with C.

C would *not* be my choice for anything involving string processing.  Ick.

Perl would probably be a good bet if you want to pick a different language.
Perl has a lot of warts, but it is good at string processing and regular
expressions and lots of people know the language so it would be easy to
get help.

Before you do that, however, make sure that some other solution actually
would be faster.  Don't write a full replacement until you actually have
a simple mostly-functional version that shows the speed benefit.

Alan
-- 
Defendit numerus




More information about the Python-list mailing list