is it noise? sub BenchIt {
print "\n\n## $^O $]\n";
use Benchmark qw {:all};
our %hash;
for (1001..2000) {
$hash{$_}++;
}
our $key1 = 2000 - int rand 1001;
our $key2 = 2000 - int rand 1001;
$hash{$key1} = 1;
$hash{$key2} = {1..10};
our $xx_global;
cmpthese (
-2,
{
svExist => 'for(1..10_000){$xx_global = exists $hash{$ke
+y1} ? 1 : 2}',
svValue => 'for(1..10_000){$xx_global = $hash{$key1} ? 1
+ : 2}',
refExist => 'for(1..10_000){$xx_global = exists $hash{$ke
+y2} ? 1 : 2} ',
refValue => 'for(1..10_000){$xx_global = $hash{$key2} ? 1
+ : 2}',
}
);
return;
}
a few old perls
## msys 5.008008
Rate svValue svExist refValue refExist
svValue 212/s -- -0% -10% -16%
svExist 212/s 0% -- -10% -16%
refValue 235/s 11% 11% -- -6%
refExist 250/s 18% 18% 6% --
## MSWin32 5.008009
Rate svValue refValue refExist svExist
svValue 210/s -- -10% -15% -16%
refValue 234/s 11% -- -6% -6%
refExist 249/s 18% 6% -- -0%
svExist 250/s 19% 7% 1% --
## MSWin32 5.012002
Rate refValue svValue refExist svExist
refValue 232/s -- -2% -4% -6%
svValue 237/s 2% -- -2% -4%
refExist 242/s 4% 2% -- -2%
svExist 247/s 6% 4% 2% --
## MSWin32 5.014001
Rate refValue refExist svExist svValue
refValue 245/s -- -4% -5% -5%
refExist 254/s 4% -- -1% -1%
svExist 258/s 5% 1% -- -0%
svValue 258/s 5% 1% 0% --
## MSWin32 5.016003
Rate refValue svValue svExist refExist
refValue 237/s -- -2% -5% -6%
svValue 242/s 2% -- -3% -4%
svExist 250/s 6% 4% -- -1%
refExist 252/s 6% 4% 1% --
## MSWin32 5.016003
Rate refValue svValue svExist refExist
refValue 222/s -- -2% -16% -16%
svValue 228/s 2% -- -14% -14%
svExist 264/s 19% 16% -- -0%
refExist 265/s 19% 16% 0% --
## MSWin32 5.018002
Rate svValue svExist refValue refExist
svValue 234/s -- -9% -10% -13%
svExist 258/s 10% -- -0% -4%
refValue 258/s 11% 0% -- -4%
refExist 269/s 15% 4% 4% --
## MSWin32 5.020003
Rate refValue refExist svValue svExist
refValue 231/s -- -1% -5% -7%
refExist 234/s 1% -- -4% -6%
svValue 243/s 5% 4% -- -3%
svExist 249/s 8% 7% 3% --
laptops fluctuate :) ## msys 5.008008
Rate svValue refValue refExist svExist
svValue 223/s -- -5% -8% -9%
refValue 235/s 5% -- -4% -4%
refExist 244/s 9% 4% -- -0%
svExist 244/s 9% 4% 0% --
## msys 5.008008
Rate svValue svExist refValue refExist
svValue 212/s -- -2% -12% -16%
svExist 216/s 2% -- -10% -14%
refValue 240/s 14% 11% -- -5%
refExist 252/s 19% 17% 5% --
## msys 5.008008
Rate svValue refValue svExist refExist
svValue 221/s -- -7% -11% -12%
refValue 238/s 8% -- -4% -5%
svExist 248/s 12% 4% -- -1%
refExist 250/s 13% 5% 1% --
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|