NAME Bencher::Scenario::Text::sprintfn - Benchmark Text::sprintfn vs sprintf() VERSION This document describes version 0.004 of Bencher::Scenario::Text::sprintfn (from Perl distribution Bencher-Scenario-Text-sprintfn), released on 2023-01-18. SYNOPSIS To run benchmark with default option: % bencher -m Text::sprintfn To run module startup overhead benchmark: % bencher --module-startup -m Text::sprintfn 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::sprintfn 0.090 BENCHMARK PARTICIPANTS * Text::sprintfn::sprintfn (perl_code) [sprintfn] Function call template: Text::sprintfn::sprintfn(, @{}) * sprintf (perl_code) [sprintf] Code template: sprintf(, @{}) BENCHMARK DATASETS * {data=>[1],format=>"%s"} * {data=>[1,2,3],format=>"%s%d%f"} * {data=>[{a=>1}],format=>"%(a)s"} * {data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"} SAMPLE BENCHMARK RESULTS Run on: perl: *v5.34.0*, CPU: *Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz (2 cores)*, OS: *GNU/Linux Ubuntu version 20.04*, OS kernel: *Linux version 5.4.0-91-generic*. Benchmark with default options ("bencher -m Text::sprintfn"): #table1# +--------------------------+------------------------------------------------------+----------+-----------+-----------+-----------------------+-----------------------+---------+---------+ | participant | dataset | p_tags | rate (/s) | time (μs) | pct_faster_vs_slowest | pct_slower_vs_fastest | errors | samples | +--------------------------+------------------------------------------------------+----------+-----------+-----------+-----------------------+-----------------------+---------+---------+ | Text::sprintfn::sprintfn | {data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"} | sprintfn | 77000 | 13 | 0.00% | 5222.11% | 1.6e-08 | 22 | | Text::sprintfn::sprintfn | {data=>[{a=>1}],format=>"%(a)s"} | sprintfn | 200000 | 5 | 157.08% | 1970.18% | 8.3e-09 | 20 | | sprintf | {data=>[1,2,3],format=>"%s%d%f"} | sprintf | 600000 | 1.7 | 672.12% | 589.29% | 1e-08 | 20 | | Text::sprintfn::sprintfn | {data=>[1,2,3],format=>"%s%d%f"} | sprintfn | 1054000 | 0.9491 | 1263.28% | 290.39% | 4.5e-11 | 20 | | Text::sprintfn::sprintfn | {data=>[1],format=>"%s"} | sprintfn | 2200000 | 0.46 | 2686.86% | 90.97% | 1e-09 | 20 | | sprintf | {data=>[1],format=>"%s"} | sprintf | 4100000 | 0.24 | 5222.11% | 0.00% | 4.3e-10 | 21 | +--------------------------+------------------------------------------------------+----------+-----------+-----------+-----------------------+-----------------------+---------+---------+ Formatted as Benchmark.pm result: Rate Ts:s sprintfn {data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"} Ts:s sprintfn {data=>[{a=>1}],format=>"%(a)s"} s sprintf {data=>[1,2,3],format=>"%s%d%f"} Ts:s sprintfn {data=>[1,2,3],format=>"%s%d%f"} Ts:s sprintfn {data=>[1],format=>"%s"} s sprintf {data=>[1],format=>"%s"} Ts:s sprintfn {data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"} 77000/s -- -61% -86% -92% -96% -98% Ts:s sprintfn {data=>[{a=>1}],format=>"%(a)s"} 200000/s 160% -- -66% -81% -90% -95% s sprintf {data=>[1,2,3],format=>"%s%d%f"} 600000/s 664% 194% -- -44% -72% -85% Ts:s sprintfn {data=>[1,2,3],format=>"%s%d%f"} 1054000/s 1269% 426% 79% -- -51% -74% Ts:s sprintfn {data=>[1],format=>"%s"} 2200000/s 2726% 986% 269% 106% -- -47% s sprintf {data=>[1],format=>"%s"} 4100000/s 5316% 1983% 608% 295% 91% -- Legends: Ts:s sprintfn {data=>[1,2,3],format=>"%s%d%f"}: dataset={data=>[1,2,3],format=>"%s%d%f"} p_tags=sprintfn participant=Text::sprintfn::sprintfn Ts:s sprintfn {data=>[1],format=>"%s"}: dataset={data=>[1],format=>"%s"} p_tags=sprintfn participant=Text::sprintfn::sprintfn Ts:s sprintfn {data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"}: dataset={data=>[{a=>1,b=>2,c=>3}],format=>"%(a)s%(b)d%(c)f"} p_tags=sprintfn participant=Text::sprintfn::sprintfn Ts:s sprintfn {data=>[{a=>1}],format=>"%(a)s"}: dataset={data=>[{a=>1}],format=>"%(a)s"} p_tags=sprintfn participant=Text::sprintfn::sprintfn s sprintf {data=>[1,2,3],format=>"%s%d%f"}: dataset={data=>[1,2,3],format=>"%s%d%f"} p_tags=sprintf participant=sprintf s sprintf {data=>[1],format=>"%s"}: dataset={data=>[1],format=>"%s"} p_tags=sprintf participant=sprintf Benchmark module startup overhead ("bencher -m Text::sprintfn --module-startup"): #table2# +---------------------+-----------+-------------------+-----------------------+-----------------------+---------+---------+ | participant | time (ms) | mod_overhead_time | pct_faster_vs_slowest | pct_slower_vs_fastest | errors | samples | +---------------------+-----------+-------------------+-----------------------+-----------------------+---------+---------+ | Text::sprintfn | 10 | 2 | 0.00% | 74.48% | 0.00039 | 20 | | perl -e1 (baseline) | 8 | 0 | 74.48% | 0.00% | 0.0002 | 23 | +---------------------+-----------+-------------------+-----------------------+-----------------------+---------+---------+ Formatted as Benchmark.pm result: Rate T:s perl -e1 (baseline) T:s 100.0/s -- -19% perl -e1 (baseline) 125.0/s 25% -- Legends: T:s: mod_overhead_time=2 participant=Text::sprintfn perl -e1 (baseline): mod_overhead_time=0 participant=perl -e1 (baseline) 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 . SOURCE Source repository is at . AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2023, 2017, 2016 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website 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.