Skip to content

Instantly share code, notes, and snippets.

@Tux
Created July 13, 2015 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tux/2a769f16bd5505be78b6 to your computer and use it in GitHub Desktop.
Save Tux/2a769f16bd5505be78b6 to your computer and use it in GitHub Desktop.
```
$ perl time.pl
csv-easy-xs 50000 0.017 0.014
csv-easy-pp 50000 0.016 0.014
csv-xsbc 50000 0.033 0.030
csv-test-xs 50000 0.037 0.035
csv-test-pp 50000 0.511 0.508
csv-pegex 50000 1.286 1.284
csv 50000 8.610 8.521
csv-ip5xs ===SORRY!===
Merging GLOBAL symbols failed: duplicate definition of symbol HLL
*** 0 0.347 0.259
csv-ip5xsio ===SORRY!===
Merging GLOBAL symbols failed: duplicate definition of symbol HLL
*** 0 0.345 0.256
csv-ip5pp ===SORRY!===
Merging GLOBAL symbols failed: duplicate definition of symbol HLL
*** 0 0.346 0.258
csv_gram *** 60000 16.067 15.979
test 50000 46.274 46.186
test-t 50000 45.764 45.675
csv-parser 50000 30.439 30.351
rm -rf /tmp/*-p5helper.so
$ cat csv-ip5xs.pl
```
``` perl
#!perl6
use v6;
use Slang::Tuxic;
use Inline::Perl5;
my $p5 = Inline::Perl5.new;
$p5.use ("Text::CSV_XS");
my @rows;
my $csv = $p5.invoke ("Text::CSV_XS", "new")
or die "Cannot use CSV: ", $p5.invoke ("Text::CSV_XS", "error_diag");
$csv.binary (1);
$csv.auto_diag (1);
my Int $sum = 0;
for lines () :eager {
$csv.parse ($_);
$sum += $csv.fields.elems;
}
$sum.say;
```
```
$ perl6 csv-ip5xs.pl
===SORRY!===
Merging GLOBAL symbols failed: duplicate definition of symbol HLL
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment