I don't have a simple csv file like:
first,second,third,
I need to parse a complex csv file like:
first,"second","my row , my column",text,number,"foo, foo",12312312312
where the fields are
- first
- "second"
- "my row , my column"
- text,number
- "foo, foo"
- 12312312312
So using the fast function built-in perl split using the , char as delimiter is not making the job easier.
I've tryed different CSV parsers modules from cpan, test were made in the same csv file (5,6GB of text) some benchmarks:
CSV_PP link
$ time test.pl quarter
real 6m5.302s
user 5m38.423s
sys 0m22.843s
Acme_CSV link
$ time test.pl quarter
real 15m32.683s
user 15m12.215s
sys 0m17.239s
CSV_XS link
$ time test.pl quarter
real 6m5.302s
user 5m38.423s
sys 0m22.843s
Conclusion: CSV_XS have the best performances for the test I made.
Hope that helps!
No comments:
Post a Comment