NAME

Bencher::Scenario::TSVParsingModules - Benchmark TSV parsing modules

VERSION

This document describes version 0.001 of Bencher::Scenario::TSVParsingModules (from Perl distribution Bencher-Scenario-TSVParsingModules), released on 2019-04-23.

SYNOPSIS

To run benchmark with default option:

 % bencher -m TSVParsingModules

To run module startup overhead benchmark:

 % bencher --module-startup -m TSVParsingModules

For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see bencher or run bencher --help.

DESCRIPTION

Packaging a benchmark script as a Bencher scenario makes it convenient to include/exclude/add participants/datasets (either via CLI or Perl code), send the result to a central repository, among others . See Bencher and bencher (CLI) for more details.

BENCHMARKED MODULES

Version numbers shown below are the versions used when running the sample benchmark.

Text::CSV_PP 1.95

Text::CSV_XS 1.31

BENCHMARK PARTICIPANTS

  • Text::CSV_PP (perl_code)

    Code template:

     my $csv = Text::CSV_PP->new({binary=>1, sep_char=>"\t", quote_char=>undef, escape_char=>undef}); open my $fh, "<", <filename>; my $rows = []; while (my $row = $csv->getline($fh)) { push @$rows, $row }
  • Text::CSV_XS (perl_code)

    Code template:

     my $csv = Text::CSV_XS->new({binary=>1, sep_char=>"\t", quote_char=>undef, escape_char=>undef}); open my $fh, "<", <filename>; my $rows = []; while (my $row = $csv->getline($fh)) { push @$rows, $row }
  • naive-split (perl_code)

    Code template:

     open my $fh, "<", <filename>; my $rows = []; while (defined(my $row = <$fh>)) { chomp $row; push @$rows, [split /\t/, $row] }

BENCHMARK DATASETS

  • bench-100x100.tsv

  • bench-10x10.tsv

  • bench-1x1.tsv

  • bench-5x5.tsv

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.26.0, CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 cores), OS: GNU/Linux LinuxMint version 18.2, OS kernel: Linux version 4.8.0-53-generic.

Benchmark with default options (bencher -m TSVParsingModules):

 #table1#
 +--------------+-------------------+-----------+-----------+------------+---------+---------+
 | participant  | dataset           | rate (/s) | time (ms) | vs_slowest |  errors | samples |
 +--------------+-------------------+-----------+-----------+------------+---------+---------+
 | Text::CSV_PP | bench-100x100.tsv |      15.3 |    65.5   |          1 | 3.9e-05 |      20 |
 | Text::CSV_XS | bench-100x100.tsv |     450   |     2.2   |         29 | 2.9e-06 |      20 |
 | naive-split  | bench-100x100.tsv |     450   |     2.2   |         29 |   4e-06 |      20 |
 | Text::CSV_PP | bench-10x10.tsv   |     960   |     1     |         63 | 1.5e-06 |      20 |
 | Text::CSV_PP | bench-5x5.tsv     |    2400   |     0.42  |        160 | 6.4e-07 |      20 |
 | Text::CSV_PP | bench-1x1.tsv     |    6400   |     0.16  |        420 | 4.3e-07 |      20 |
 | Text::CSV_XS | bench-10x10.tsv   |   11000   |     0.093 |        710 | 2.1e-07 |      20 |
 | Text::CSV_XS | bench-5x5.tsv     |   15000   |     0.066 |        990 | 1.1e-07 |      20 |
 | Text::CSV_XS | bench-1x1.tsv     |   19200   |     0.052 |       1260 | 2.6e-08 |      21 |
 | naive-split  | bench-10x10.tsv   |   25000   |     0.04  |       1600 | 4.9e-08 |      24 |
 | naive-split  | bench-5x5.tsv     |   53000   |     0.019 |       3500 | 2.7e-08 |      20 |
 | naive-split  | bench-1x1.tsv     |   99000   |     0.01  |       6500 | 1.3e-08 |      21 |
 +--------------+-------------------+-----------+-----------+------------+---------+---------+

Benchmark module startup overhead (bencher -m TSVParsingModules --module-startup):

 #table2#
 +---------------------+-----------+------------------------+------------+-----------+---------+
 | participant         | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors   | samples |
 +---------------------+-----------+------------------------+------------+-----------+---------+
 | Text::CSV_PP        |      27   |                   20.9 |        1   | 4.3e-05   |      20 |
 | Text::CSV_XS        |      24   |                   17.9 |        1.1 |   0.00013 |      21 |
 | perl -e1 (baseline) |       6.1 |                    0   |        4.4 | 4.6e-05   |      20 |
 +---------------------+-----------+------------------------+------------+-----------+---------+

To display as an interactive HTML table on a browser, you can add option --format html+datatables.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Bencher-Scenario-TSVParsingModules.

SOURCE

Source repository is at https://github.com/perlancar/perl-Bencher-Scenario-TSVParsingModules.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenario-TSVParsingModules

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.