Bencher-Scenarios-SortSub

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


	- No functional changes.

        - [build] Rebuild with updated Dist::Zilla::Plugin::Bencher::Scenario
          (0.16) to add benchmarked modules as prereq with phase=x_benchmarks,
          type=x_benchmarks.


0.002   2017-01-19 (PERLANCAR)

	- Add participants: Sort::Naturally::XS::nsort,
	  Sort::Naturally::XS::ncmp, Sort::Naturally::ncmp.


0.001   2016-12-12 (PERLANCAR)

        - First release.

META.json  view on Meta::CPAN

         "requires" : {
            "Pod::Coverage::TrustPod" : "0",
            "Test::Pod" : "1.41",
            "Test::Pod::Coverage" : "1.08"
         }
      },
      "runtime" : {
         "requires" : {
            "List::Util" : "0",
            "Sort::Key::Natural" : "0",
            "Sort::Naturally" : "0",
            "Sort::Naturally::XS" : "0",
            "Sort::Sub" : "0.05",
            "strict" : "0",
            "warnings" : "0"
         }
      },
      "test" : {
         "requires" : {
            "Bencher::Backend" : "1.034",
            "File::Spec" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Test::More" : "0"
         }
      },
      "x_benchmarks" : {
         "requires" : {
            "Sort::Key::Natural" : "0",
            "Sort::Naturally" : "0",
            "Sort::Naturally::XS" : "0",
            "Sort::Sub" : "0.05"
         },
         "x_benchmarks" : {
            "Sort::Key::Natural" : "0",
            "Sort::Naturally" : "0",
            "Sort::Naturally::XS" : "0",
            "Sort::Sub" : "0.05"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-SortSub"
      },
      "homepage" : "https://metacpan.org/release/Bencher-Scenarios-SortSub",

META.yml  view on Meta::CPAN

dynamic_config: 0
generated_by: 'Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Bencher-Scenarios-SortSub
requires:
  List::Util: '0'
  Sort::Key::Natural: '0'
  Sort::Naturally: '0'
  Sort::Naturally::XS: '0'
  Sort::Sub: '0.05'
  strict: '0'
  warnings: '0'
resources:
  bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-SortSub
  homepage: https://metacpan.org/release/Bencher-Scenarios-SortSub
  repository: git://github.com/perlancar/perl-Bencher-Scenarios-SortSub.git
version: '0.005'
x_Dist_Zilla:
  perl:

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Bencher-Scenarios-SortSub",
  "LICENSE" => "perl",
  "NAME" => "Bencher::Scenarios::SortSub",
  "PREREQ_PM" => {
    "List::Util" => 0,
    "Sort::Key::Natural" => 0,
    "Sort::Naturally" => 0,
    "Sort::Naturally::XS" => 0,
    "Sort::Sub" => "0.05",
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "Bencher::Backend" => "1.034",
    "File::Spec" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::More" => 0

Makefile.PL  view on Meta::CPAN

);


my %FallbackPrereqs = (
  "Bencher::Backend" => "1.034",
  "File::Spec" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "List::Util" => 0,
  "Sort::Key::Natural" => 0,
  "Sort::Naturally" => 0,
  "Sort::Naturally::XS" => 0,
  "Sort::Sub" => "0.05",
  "Test::More" => 0,
  "strict" => 0,
  "warnings" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};

lib/Bencher/Scenario/SortSub/naturally.pm  view on Meta::CPAN

        'Sort::Sub' => {version=>'0.05'},
    },
    participants => [
        {
            name => 'Sort::Sub::naturally',
            module => 'Sort::Sub',
            code_template => 'sort $Bencher::Scenario::SortSub::naturally::naturally @{<data>}',
            result_is_list => 1,
        },
        {
            fcall_template => 'Sort::Naturally::nsort(@{<data>})',
            result_is_list => 1,
        },
        {
            name => 'Sort::Naturally::ncmp',
            module => 'Sort::Naturally',
            code_template => 'sort {Sort::Naturally::ncmp($a, $b)} @{<data>}',
            result_is_list => 1,
        },
        {
            fcall_template => 'Sort::Naturally::XS::nsort(@{<data>})',
            result_is_list => 1,
        },
        {
            name => 'Sort::Naturally::XS::ncmp',
            module => 'Sort::Naturally::XS',
            code_template => 'sort {Sort::Naturally::XS::ncmp($a, $b)} @{<data>}',
            result_is_list => 1,
        },
        {
            fcall_template => 'Sort::Key::Natural::natsort(@{<data>})',
            result_is_list => 1,
        },
    ],
    datasets => [
        { name=>'10items' , args=>{data=>[shuffle map { "track$_.mp3" } 1..10 ]} , result=>[map { "track$_.mp3" } 1..10 ]},
        { name=>'100items', args=>{data=>[shuffle map { "track$_.mp3" } 1..100]} , result=>[map { "track$_.mp3" } 1..100]},

lib/Bencher/Scenario/SortSub/naturally.pm  view on Meta::CPAN

=head1 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 L<Bencher> and L<bencher> (CLI) for more de...

=head1 BENCHMARKED MODULES

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

L<Sort::Key::Natural> 0.04

L<Sort::Naturally> 1.03

L<Sort::Naturally::XS> 0.7.3

L<Sort::Sub> 0.10

=head1 BENCHMARK PARTICIPANTS

=over

=item * Sort::Sub::naturally (perl_code)

Code template:

 sort $Bencher::Scenario::SortSub::naturally::naturally @{<data>}



=item * Sort::Naturally::nsort (perl_code)

Function call template:

 Sort::Naturally::nsort(@{<data>})



=item * Sort::Naturally::ncmp (perl_code)

Code template:

 sort {Sort::Naturally::ncmp($a, $b)} @{<data>}



=item * Sort::Naturally::XS::nsort (perl_code)

Function call template:

 Sort::Naturally::XS::nsort(@{<data>})



=item * Sort::Naturally::XS::ncmp (perl_code)

Code template:

 sort {Sort::Naturally::XS::ncmp($a, $b)} @{<data>}



=item * Sort::Key::Natural::natsort (perl_code)

Function call template:

 Sort::Key::Natural::natsort(@{<data>})


lib/Bencher/Scenario/SortSub/naturally.pm  view on Meta::CPAN


Run on: perl: I<< v5.24.0 >>, CPU: I<< Intel(R) Core(TM) M-5Y71 CPU @ 1.20GHz (2 cores) >>, OS: I<< GNU/Linux LinuxMint version 17.3 >>, OS kernel: I<< Linux version 3.19.0-32-generic >>.

Benchmark with default options (C<< bencher -m SortSub::naturally >>):

 #table1#
 {dataset=>"100items"}
 +-----------------------------+-----------+-----------+------------+---------+---------+
 | participant                 | rate (/s) | time (ms) | vs_slowest |  errors | samples |
 +-----------------------------+-----------+-----------+------------+---------+---------+
 | Sort::Naturally::nsort      |       578 |  1.73     |        1   | 9.1e-07 |      20 |
 | Sort::Key::Natural::natsort |      2000 |  0.5      |        3   | 5.9e-06 |      20 |
 | Sort::Naturally::XS::nsort  |      7950 |  0.126    |       13.8 | 4.7e-08 |      26 |
 | Sort::Sub::naturally        |    200000 |  0.005    |      400   | 8.4e-08 |      31 |
 | Sort::Naturally::XS::ncmp   |    233800 |  0.004277 |      404.5 | 4.6e-11 |      20 |
 | Sort::Naturally::ncmp       |    235000 |  0.00426  |      406   | 1.7e-09 |      20 |
 +-----------------------------+-----------+-----------+------------+---------+---------+

 #table2#
 {dataset=>"10items"}
 +-----------------------------+-----------+-----------+------------+---------+---------+
 | participant                 | rate (/s) | time (μs) | vs_slowest |  errors | samples |
 +-----------------------------+-----------+-----------+------------+---------+---------+
 | Sort::Naturally::nsort      |     15000 | 65        |      1     | 1.1e-07 |      20 |
 | Sort::Key::Natural::natsort |     18000 | 55        |      1.2   |   8e-08 |      20 |
 | Sort::Naturally::XS::nsort  |    189260 |  5.2838   |     12.278 | 1.2e-11 |      24 |
 | Sort::Naturally::ncmp       |   1580000 |  0.633    |    103     |   2e-10 |      21 |
 | Sort::Sub::naturally        |   1768950 |  0.565308 |    114.758 |   0     |      20 |
 | Sort::Naturally::XS::ncmp   |   1794000 |  0.5576   |    116.4   | 4.1e-11 |      20 |
 +-----------------------------+-----------+-----------+------------+---------+---------+


Benchmark module startup overhead (C<< bencher -m SortSub::naturally --module-startup >>):

 #table3#
 +---------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | participant         | proc_private_dirty_size (MB) | proc_rss_size (MB) | proc_size (MB) | time (ms) | mod_overhead_time (ms) | vs_slowest |  errors | samples |
 +---------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+
 | Sort::Key::Natural  | 1.4                          | 4.8                | 19             |      27   |                   21.6 |        1   |   6e-05 |      20 |
 | Sort::Naturally::XS | 1.4                          | 4.7                | 19             |      12   |                    6.6 |        2.3 | 1.5e-05 |      21 |
 | Sort::Naturally     | 1.2                          | 4.7                | 16             |      11   |                    5.6 |        2.4 | 4.4e-05 |      20 |
 | Sort::Sub           | 1.2                          | 4.7                | 16             |       7.9 |                    2.5 |        3.4 |   2e-05 |      20 |
 | perl -e1 (baseline) | 0.87                         | 4.2                | 16             |       5.4 |                    0   |        5   |   1e-05 |      20 |
 +---------------------+------------------------------+--------------------+----------------+-----------+------------------------+------------+---------+---------+


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

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/Bencher-Scenarios-SortSub>.

lib/Bencher/ScenarioR/SortSub/naturally.pm  view on Meta::CPAN


our $VERSION = 0.005; # VERSION

our $results = [
  [
    200,
    "OK",
    [
      {
        errors => 9.1e-07,
        participant => "Sort::Naturally::nsort",
        rate => 578,
        samples => 20,
        time => 1.73,
        vs_slowest => 1,
      },
      {
        errors => 5.9e-06,
        participant => "Sort::Key::Natural::natsort",
        rate => 2000,
        samples => 20,
        time => 0.5,
        vs_slowest => 3,
      },
      {
        errors => 4.7e-08,
        participant => "Sort::Naturally::XS::nsort",
        rate => 7950,
        samples => 26,
        time => 0.126,
        vs_slowest => 13.8,
      },
      {
        errors => 8.4e-08,
        participant => "Sort::Sub::naturally",
        rate => 200000,
        samples => 31,
        time => 0.005,
        vs_slowest => 400,
      },
      {
        errors => 4.6e-11,
        participant => "Sort::Naturally::XS::ncmp",
        rate => 233800,
        samples => 20,
        time => 0.004277,
        vs_slowest => 404.5,
      },
      {
        errors => 1.7e-09,
        participant => "Sort::Naturally::ncmp",
        rate => 235000,
        samples => 20,
        time => 0.00426,
        vs_slowest => 406,
      },
    ],
    {
      "func.bencher_args"              => {
                                            action => "bench",
                                            note => "Run by Pod::Weaver::Plugin::Bencher::Scenario",

lib/Bencher/ScenarioR/SortSub/naturally.pm  view on Meta::CPAN

                                          ],
      "func.elapsed_time"              => 0.346285104751587,
      "func.module_startup"            => undef,
      "func.module_versions"           => {
                                            "__PACKAGE__"                           => 1.034,
                                            "Bencher::Scenario::SortSub::naturally" => undef,
                                            "Benchmark::Dumb"                       => "0.10",
                                            "Devel::Platform::Info"                 => 0.16,
                                            "perl"                                  => "v5.24.0",
                                            "Sort::Key::Natural"                    => 0.04,
                                            "Sort::Naturally"                       => 1.03,
                                            "Sort::Naturally::XS"                   => "0.7.3",
                                            "Sort::Sub"                             => "0.10",
                                            "Sys::Info"                             => 0.78,
                                          },
      "func.note"                      => "Run by Pod::Weaver::Plugin::Bencher::Scenario",
      "func.permute"                   => ["participant", [0 .. 5], "perl", ["perl"]],
      "func.platform_info"             => {
                                            archname => "x86_64",
                                            codename => "rosa",
                                            is32bit  => 0,
                                            is64bit  => 1,

lib/Bencher/ScenarioR/SortSub/naturally.pm  view on Meta::CPAN

      "table.field_units"              => [undef, "/s", "ms"],
      "table.fields"                   => ["participant", "rate", "time", "vs_slowest", "errors", "samples"],
    },
  ],
  [
    200,
    "OK",
    [
      {
        errors => 1.1e-07,
        participant => "Sort::Naturally::nsort",
        rate => 15000,
        samples => 20,
        time => 65,
        vs_slowest => 1,
      },
      {
        errors => 8e-08,
        participant => "Sort::Key::Natural::natsort",
        rate => 18000,
        samples => 20,
        time => 55,
        vs_slowest => 1.2,
      },
      {
        errors => 1.2e-11,
        participant => "Sort::Naturally::XS::nsort",
        rate => 189260,
        samples => 24,
        time => 5.2838,
        vs_slowest => 12.278,
      },
      {
        errors => 2e-10,
        participant => "Sort::Naturally::ncmp",
        rate => 1580000,
        samples => 21,
        time => 0.633,
        vs_slowest => 103,
      },
      {
        errors => 0,
        participant => "Sort::Sub::naturally",
        rate => 1768950,
        samples => 20,
        time => 0.565308,
        vs_slowest => 114.758,
      },
      {
        errors => 4.1e-11,
        participant => "Sort::Naturally::XS::ncmp",
        rate => 1794000,
        samples => 20,
        time => 0.5576,
        vs_slowest => 116.4,
      },
    ],
    {
      "func.bencher_args"              => {
                                            action => "bench",
                                            note => "Run by Pod::Weaver::Plugin::Bencher::Scenario",

lib/Bencher/ScenarioR/SortSub/naturally.pm  view on Meta::CPAN

                                          ],
      "func.elapsed_time"              => 0.346285104751587,
      "func.module_startup"            => undef,
      "func.module_versions"           => {
                                            "__PACKAGE__"                           => 1.034,
                                            "Bencher::Scenario::SortSub::naturally" => undef,
                                            "Benchmark::Dumb"                       => "0.10",
                                            "Devel::Platform::Info"                 => 0.16,
                                            "perl"                                  => "v5.24.0",
                                            "Sort::Key::Natural"                    => 0.04,
                                            "Sort::Naturally"                       => 1.03,
                                            "Sort::Naturally::XS"                   => "0.7.3",
                                            "Sort::Sub"                             => "0.10",
                                            "Sys::Info"                             => 0.78,
                                          },
      "func.note"                      => "Run by Pod::Weaver::Plugin::Bencher::Scenario",
      "func.permute"                   => ["participant", [0 .. 5], "perl", ["perl"]],
      "func.platform_info"             => {
                                            archname => "x86_64",
                                            codename => "rosa",
                                            is32bit  => 0,
                                            is64bit  => 1,



( run in 2.781 seconds using v1.01-cache-2.11-cpan-524268b4103 )