in reply to Benchmark comparison of Text::xSV and Text::CSV_XS

I have not benchmarked Text::xSV, but not only is it in pure Perl, but it was not written with an eye to efficiency. This is pointed out in the bugs section, as is the fact that its performance will get drastically worse if you ever use $`, $& or $'.

Given that, I'd be very pleased if it was only 3 times slower than the XS version. However I doubt that I perform that well.

First of all to improve the performance, your read_xSV would be more efficient if you used the fact that get_row() returns the row in array context, so you don't have to call extract. I encourage using the extract method because working "by name" tends to be less buggy than working "by position". OTOH since I'm encouraging people to use extract, you've written it in the way that most people would hopefully write that.

And your benchmark should be rewritten with the error-checks commented out. I guarantee that those checks are taking a non-trivial fraction of the overall time. If you remove them, then I'd bet that the C version does a lot better still than the pure Perl version.

UPDATE: Removed a redundant "is encouraged". Thanks, radiantmatrix.

  • Comment on Re: Benchmark comparison of Text::xSV and Text::CSV_XS