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):

#!/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 '*'; }
Results for three runs (I've trimmed the status indicators):
  1.       Rate  xSV  CSV
    xSV 2.11/s   -- -75%
    CSV 8.51/s 304%   --
    
  2.       Rate  xSV  CSV
    xSV 2.20/s   -- -74%
    CSV 8.52/s 287%   --
    
  3.       Rate  xSV  CSV
    xSV 2.19/s   -- -74%
    CSV 8.40/s 284%   --
    
As you can see, Text::CSV_XS is noticably faster than Text::xSV, though the margins are not as large as on my Linux machines. I'm glad that someone pointed out that CSV_XS is now available through ASPN, as it allows me to write fast, portable CSV-handling code now. ;-)

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)}


In reply to Benchmark comparison of Text::xSV and Text::CSV_XS (New for Windows) by radiantmatrix
in thread Benchmark comparison of Text::xSV and Text::CSV_XS by jZed

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.