[Haskell-cafe] another Newbie performance question

Philip Müller mail at philip.in-aachen.net
Sat May 17 13:22:36 EDT 2008


Hi everybody,

I was doing an assignment in Java for my university concerning a program 
that reads, modifies and writes CSV files, when I suddenly had the idea 
of implementing parts of this in Haskell for fun.

When I finished the Haskell programm, I was disappointed by the performance:
To parse a 200k lines CSV file, insert a line (yes I know i could insert 
a line without parsing the file, that's just an example) at pos. 199999 
and write the file again, the Java program takes 1.1 seconds while the 
Haskell program takes 12.5 seconds.

I have read Don's blog post but am unsure how to implement his tips into 
my program, as I am still kind of a Haskell beginner.

The source code (40 lines incl. comments and empty lines) and the 200k 
CSV file I used for testing and a smaller CSV file demonstrating the 
special easy-to-parse CSV syntax are available on my ftp server,

ftp://baah.servegame.org/public/haskell

The call syntax is
<program> <csv file> <line to insert>
e.g.
main lang.csv "test","this","line"

I haven't posted the source code here directly because I thought it 
might be too long.

If someone here finds the time to look at my code and give me some 
hints, that would really be nice.


Regards
Philip


More information about the Haskell-Cafe mailing list