Python slow for filter scripts

Peter Mutsaers plm at gmx.li
Tue Oct 28 15:33:15 EST 2003


Hello,

Up to now I mostly wrote simple filter scripts in Perl, e.g.

while(<>) {
  # do something with $_, regexp matching, replacements etc.
  print;
}

Now I learned Python and like it much more as a language.

However, I tried the most simple while(<>) {print;} in Perl versus
Python, just a copy from stdin to stdout, to see how fast the basic
filter can be.

I found that on my (linux) PC, the Python version was 4 times slower.

Is that normal, does it disqualify Python for simple filter scripts?




More information about the Python-list mailing list