[Melbourne-pm] Still performing well..

Toby Corkindale toby.corkindale at strategicdata.com.au
Mon May 17 20:49:23 PDT 2010


After the last Perlmongers meeting I was curious to benchmark Perl vs Go 
vs Scala in more than just a trivial case.

I setup a test to read in a large CSV file, performing some minor 
numeric and text manipulation upon each row, and outputing the results.

I timed the results within the apps, so as to avoid the start-up time, 
and will report both below.


Language  :   Process time   : Total time
Perl 5.10 :   1089 ms        : 1153 ms
Go        :   1682 ms        : 1687 ms
Scala 2.8 :   2729 ms        : 3114 ms


Note that Perl (using Text::CSV) came out ahead of the natively-compiled 
Go (using a third-party CSV library)! That surprised me!
I was also surprised at how slow Scala was, especially since I was lazy 
and just used String.split(",") rather than a proper CSV library, which 
should be faster.

On the other hand - my test was clearly biassed towards Perl's 
text-processing strengths, and avoided known weaknesses like object 
creation.

It would be interesting to create another test that performed real-time 
multi-threaded stream analysis of XML data instead.

I should also note that Scala and Perl produced identical output, 
whereas Go's output had slight variances in a few of the floating point 
results. (I think it was their printf performing different rounding.)

-Toby


More information about the Melbourne-pm mailing list