NAME

Bencher::Scenario::LevenshteinModules - Benchmark various modules calculating the Levenshtein edit distance

VERSION

This document describes version 0.11 of Bencher::Scenario::LevenshteinModules (from Perl distribution Bencher-Scenarios-LevenshteinModules), released on 2016-10-14.

SYNOPSIS

To run benchmark with default option:

% bencher -m LevenshteinModules

To run module startup overhead benchmark:

% bencher --module-startup -m LevenshteinModules

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.

PERLANCAR::Text::Levenshtein 0.02

Text::Levenshtein 0.13

Text::Levenshtein::Flexible 0.09

Text::Levenshtein::XS 0.503

Text::LevenshteinXS 0.03

BENCHMARK PARTICIPANTS

  • PERLANCAR::Text::Levenshtein::editdist (perl_code) [no_unicode_support]

    Function call template:

    PERLANCAR::Text::Levenshtein::editdist(<word1>, <word2>)
  • Text::Levenshtein::fastdistance (perl_code)

    Function call template:

    Text::Levenshtein::fastdistance(<word1>, <word2>)
  • Text::Levenshtein::XS::distance (perl_code)

    Function call template:

    Text::Levenshtein::XS::distance(<word1>, <word2>)
  • Text::Levenshtein::Flexible::levenshtein (perl_code)

    Function call template:

    Text::Levenshtein::Flexible::levenshtein(<word1>, <word2>)
  • Text::LevenshteinXS::distance (perl_code) [no_unicode_support]

    Function call template:

    Text::LevenshteinXS::distance(<word1>, <word2>)

BENCHMARK DATASETS

  • a

  • foo

  • program

  • reve [unicode]

  • euro [unicode]

SAMPLE BENCHMARK RESULTS

Run on: perl: v5.24.0, CPU: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz (4 cores), OS: GNU/Linux Debian version 8.0, OS kernel: Linux version 3.16.0-4-amd64.

Benchmark with default options (bencher -m LevenshteinModules):

#table1#
+------------------------------------------+---------+-----------+-----------+------------+---------+---------+
| participant                              | dataset | rate (/s) | time (μs) | vs_slowest |  errors | samples |
+------------------------------------------+---------+-----------+-----------+------------+---------+---------+
| Text::Levenshtein::fastdistance          | program |   11000   | 88        |    1       | 2.1e-07 |      20 |
| PERLANCAR::Text::Levenshtein::editdist   | program |   22766.4 | 43.9243   |    2.00492 | 1.2e-11 |      20 |
| Text::Levenshtein::fastdistance          | reve    |   26000   | 38        |    2.3     | 5.3e-08 |      20 |
| Text::Levenshtein::fastdistance          | euro    |   29000   | 34        |    2.6     | 5.1e-08 |      22 |
| Text::Levenshtein::fastdistance          | foo     |   52000   | 19        |    4.6     | 8.7e-08 |      20 |
| PERLANCAR::Text::Levenshtein::editdist   | foo     |   88055   | 11.357    |    7.7546  | 1.1e-11 |      20 |
| Text::Levenshtein::fastdistance          | a       |  170000   |  6.1      |   15       | 6.5e-09 |      21 |
| PERLANCAR::Text::Levenshtein::editdist   | a       |  348500   |  2.869    |   30.69    | 5.4e-11 |      20 |
| Text::Levenshtein::XS::distance          | program |  480000   |  2.09     |   42.2     | 8.3e-10 |      20 |
| Text::Levenshtein::XS::distance          | reve    |  614650   |  1.6269   |   54.129   | 1.1e-11 |      30 |
| Text::Levenshtein::XS::distance          | euro    |  660600   |  1.514    |   58.18    | 4.7e-11 |      25 |
| Text::Levenshtein::XS::distance          | foo     |  732018   |  1.36609  |   64.465   |   0     |      20 |
| Text::Levenshtein::XS::distance          | a       |  898180   |  1.1134   |   79.098   | 9.1e-12 |      22 |
| Text::LevenshteinXS::distance            | program | 3180000   |  0.315    |  280       | 2.1e-10 |      20 |
| Text::Levenshtein::Flexible::levenshtein | program | 4170000   |  0.24     |  367       | 9.2e-11 |      26 |
| Text::Levenshtein::Flexible::levenshtein | euro    | 4360000   |  0.229    |  384       | 4.2e-11 |      20 |
| Text::Levenshtein::Flexible::levenshtein | reve    | 6200000   |  0.16     |  540       | 4.1e-10 |      23 |
| Text::LevenshteinXS::distance            | foo     | 7250000   |  0.138    |  639       | 5.2e-11 |      20 |
| Text::Levenshtein::Flexible::levenshtein | foo     | 7520000   |  0.133    |  662       |   1e-10 |      21 |
| Text::Levenshtein::Flexible::levenshtein | a       | 8358530   |  0.119638 |  736.092   |   0     |      32 |
| Text::LevenshteinXS::distance            | a       | 8880000   |  0.113    |  782       | 5.7e-11 |      22 |
+------------------------------------------+---------+-----------+-----------+------------+---------+---------+

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

#table2#
+------------------------------+-----------+------------------------+------------+---------+---------+
| participant                  | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
+------------------------------+-----------+------------------------+------------+---------+---------+
| Text::LevenshteinXS          |      14   |      9.3               |        1   | 4.3e-05 |      21 |
| Text::Levenshtein            |      13   |      8.3               |        1.1 | 5.9e-05 |      20 |
| Text::Levenshtein::Flexible  |      12   |      7.3               |        1.2 | 7.1e-05 |      20 |
| Text::Levenshtein::XS        |       8.8 |      4.1               |        1.7 | 4.3e-05 |      20 |
| PERLANCAR::Text::Levenshtein |       5.1 |      0.399999999999999 |        2.8 | 2.1e-05 |      23 |
| perl -e1 (baseline)          |       4.7 |      0                 |        3.1 | 2.7e-05 |      20 |
+------------------------------+-----------+------------------------+------------+---------+---------+

HOMEPAGE

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

SOURCE

Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-LevenshteinModules.

BUGS

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

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.

SEE ALSO

Bencher::Scenario::DamerauLevenshteinModules

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 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.