Bencher::Scenario::Perl::5200Perf_return - Benchmark return() being optimized away
This document describes version 0.050 of Bencher::Scenario::Perl::5200Perf_return (from Perl distribution Bencher-Scenarios-Perl), released on 2019-10-20.
To run benchmark with default option:
% bencher -m Perl::5200Perf_return
For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see bencher or run bencher --help.
bencher --help
From perl5200delta: In certain situations, when return is the last statement in a subroutine's main scope, it will be optimized out. This means code like:
sub baz { return $cat; }
will now behave like:
sub baz { $cat; }
which is notably faster.
[perl #120765].
return (perl_code)
Code template:
my $var = 1; return $var
Please visit the project's homepage at https://metacpan.org/release/Bencher-Scenarios-Perl.
Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-Perl.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-Perl
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.
perl5200delta
perlancar <perlancar@cpan.org>
This software is copyright (c) 2019, 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.
To install Bencher::Scenarios::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bencher::Scenarios::Perl
CPAN shell
perl -MCPAN -e shell install Bencher::Scenarios::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.