I’m working on a set of data refreshment scripts, which get data from file, do some transform, then send to a HTTP interface. Since the HTTP interface is kind of slow compare with reading and transforming data, I have several forked children processes to handle HTTP part.
Everything was done by Perl about 6 months ago, and everything seems good … until I started picking up Python. First sight is that Pyhon program is about 50% of Perl in term of LOC, which makes it easier to read, but seriously I don’t care about this too much as the logic is quite simple, however, when I tested Python programs and found that they are at least 50% faster than Perl’s, I felt nervous.
Two examples – Perl takes 13 seconds, Python takes 5, Perl takes 34 minutes, Python takes 10. Actually I’m really nervous at this moment thinking of my poor Python skills, I always worry if I made anything wrong with the translation (from Perl to Python), even I have verified result data for quite some times.
Will dig in after converting all scripts to Python.
One Response to “Python vs. Perl”
Sorry, the comment form is closed at this time.
I didn’t get a consistent number across all scripts – for 5 data loading scripts I have, 4 of them gain >50% performance as mentioned above, but the the last one is almost identical. There is no significant different in all these scripts, I mean in logic, though the special one is handling large amount of data compare with others, but data is just a pipe flow through the processing codes, I’m not storing them at all …
I will leave things running some more days and see if it is just a abnormal case.