I am not sure how you are interpreting these results, but the wit is running faster. As to why it isn't the 50% expected, I would suggest you run the following instead:
#!/usr/bin/perl use strict; use warnings; use Benchmark 'cmpthese'; cmpthese( -25, { non => sub{my $g = 100_000; my $lim = 100_000; for ( my $i = 1; $i < $lim; ++$i ) { --$g }}, wit => sub{my $g = 100_000; my $lim = 100_000; for ( my $i = 1; $i < $lim; ++$i ) { --$lim }} } ); __DATA__ Rate non wit non 103/s -- -50% wit 206/s 99% --
Cheers - L~R
In reply to Re: for limit
by Limbic~Region
in thread for limit
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |