Perl vs. Python for text manipulation
aahz at pythoncraft.com
Sat Jan 24 17:51:06 CET 2004
In article <buu6j5$12lf$1 at nadya.doma>, Serge Orlov <sombDELETE at pobox.ru> wrote:
>"Ganesan R" <rganesan at myrealbox.com> wrote in message news:ou4qulnwy0.fsf at andlx-anamika.cisco.com...
>> fileinput is not optimized yet, at least I don't remember any mails
>> about fileinput in python-devel since python 2.3 was released. I
>> know that it is slow. for line in file: does seem to be optimized
>> though. The last time I ran the tests python was definitely twice as
>> slow (which was before python 2.3 was officially released); now it
>> appears to be only about 40% slower. I need to revisit these crude
>Since this problem is not IO bound but rather python internals bound,
>it makes sense to try psyco.
Pysco won't help and might actually make things worse. At this point,
Perl's speed advantage should come from two and only two sources: Perl
optimizes the snot out of platform I/O (so these speed tests don't apply
to a platform Perl hasn't been ported to), and Perl does not use the
thread-safe forms of I/O. Python does a fair amount of internal caching
to make up for that, and the file object is already written in C.
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code --
not in reams of trivial code that bores the reader to death." --GvR
More information about the Python-list