in reply to Benchmark comparison of Text::xSV and Text::CSV_XS
Because the original issue was one of the Windows version of CSV_XS, I have composed a Benchmark similar to my orignal. This covers reading only, and uses the ASPN version of CSV_XS (as opposed to compiling it myself):
Results for three runs (I've trimmed the status indicators):#!/usr/bin/perl use strict; use warnings; use Benchmark qw(:all); my @buffer; cmpthese( 200, { 'xSV' => \&xSV, 'CSV' => \&CSV_XS } ); sub xSV { print STDERR '.'; use Text::xSV; my $xsv = new Text::xSV(filename=>"sample.csv", sep=>';'); while (my $row = $xsv->get_row) { @buffer = @$row; #just a "do something" instruction } undef @buffer; print STDERR '.'; } sub CSV_XS { print STDERR '*'; use Text::CSV_XS; use IO::File; my $io = new IO::File "< sample.csv"; my $csv = new Text::CSV_XS({sep_char=>';'}); while (my $row = $csv->getline($io)) { last unless @$row; @buffer = @$row; #just a "do something" instruction } undef @buffer; $io->close; print STDERR '*'; }
Rate xSV CSV
xSV 2.11/s -- -75%
CSV 8.51/s 304% --
Rate xSV CSV
xSV 2.20/s -- -74%
CSV 8.52/s 287% --
Rate xSV CSV
xSV 2.19/s -- -74%
CSV 8.40/s 284% --
I guess I don't know how to optimize a compiler for Windows... but I knew that already.
radiantmatrix
require General::Disclaimer;
s//2fde04abe76c036c9074586c1/; while(m/(.)/g){print substr(' ,JPacehklnorstu',hex($1),1)}
|
|---|