KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been a Perl guy for over 10 years but a friend convinced me to try Python and told me how much faster it is than Perl. So just for kicks I ported an app I wrote in Perl to Python and found that it runs about 3x slower. Initially my friend told me that I must have done it wrong, so I rewrote and refactored until I could rewrite and refactor no more and ... it's still a lot slower. So I did a simple test: i = 0 j = 0 while (i < 100000000): i = i + 1 j = j + 1 print j $ time python python.py 100000000 real 0m48.100s user 0m45.633s sys 0m0.043s my $i = 0; my $j = 0; while ($i < 100000000) { ++$i; # also tested $i = $i + 1 to be fair, same result ++$j; } print $j; $ time perl perl.pl 100000000 real 0m24.757s user 0m22.341s sys 0m0.029s Just under twice as slow, which doesn't seem to reflect any of the benchmarks I've seen ... is there a problem with my installation or is Python really that much slower than Perl ?
Tags (comma-separated)
Save Edits
Cancel