Skip to content

Instantly share code, notes, and snippets.

@earino
Created Feb 28, 2013
Embed
What would you like to do?
Results of the run
$VAR1 = {
'readonly' => sub {
use warnings;
use strict 'refs';
my $i = 0;
if (defined $test_hash{$READONLY_KEY}) {
if ($test_hash{$READONLY_KEY} eq $READONLY_VALUE) {
$i++;
}
}
},
'use_constant' => sub {
use warnings;
use strict 'refs';
my $i = 0;
if (defined $test_hash{'key'}) {
if ($test_hash{'key'} eq 'value') {
$i++;
}
}
},
'const_fast' => sub {
use warnings;
use strict 'refs';
my $i = 0;
if (defined $test_hash{$CONST_FAST_KEY}) {
if ($test_hash{$CONST_FAST_KEY} eq $CONST_FAST_VALUE) {
$i++;
}
}
}
};
use_constant: Ran 1214 iterations (189 outliers).
use_constant: Rounded run time per iteration: 4.6662e-07 +/- 1.2e-10 (0.0%)
readonly: Ran 1214 iterations (186 outliers).
readonly: Rounded run time per iteration: 4.7046e-06 +/- 2.1e-09 (0.0%)
const_fast: Ran 1546 iterations (528 outliers).
const_fast: Rounded run time per iteration: 4.6802e-07 +/- 1.2e-10 (0.0%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment