This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Benchmark.t: avoid ultra-lightweight code
[perl5.git]
/
lib
/
Benchmark.t
diff --git
a/lib/Benchmark.t
b/lib/Benchmark.t
index
177af10
..
7706bba
100644
(file)
--- a/
lib/Benchmark.t
+++ b/
lib/Benchmark.t
@@
-401,7
+401,9
@@
sub check_graph {
{
select(OUT);
my $start = times;
{
select(OUT);
my $start = times;
- my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" }, "auto" ) ;
+ my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)",
+ b => "\$i = sqrt(\$i++)",
+ }, "auto" ) ;
my $end = times;
select(STDOUT);
ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");
my $end = times;
select(STDOUT);
ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");
@@
-423,7
+425,8
@@
sub check_graph {
{
select(OUT);
my $start = times;
{
select(OUT);
my $start = times;
- my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" } ) ;
+ my $chart = cmpthese( -0.1, { a => "\$i = sqrt(\$i++) * sqrt(\$i)",
+ b => "\$i = sqrt(\$i++)" });
my $end = times;
select(STDOUT);
ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");
my $end = times;
select(STDOUT);
ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");