Last active
May 4, 2016 11:15
-
-
Save dakkar/eac6a7ad32d8e91ef2f8a95af55e7598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Benchmark; | |
use List::Util; | |
my @keys = List::Util::shuffle( (1..500) x 1000, 600..800 ); | |
Benchmark::cmpthese(-5, { | |
with_test => 'my %h; for my $k (@keys) { $h{$k}=1 unless exists $h{$k} }', | |
no_test => 'my %h; for my $k (@keys) { $h{$k}=1 }', | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rate with_test no_test | |
with_test 1852124/s -- -0% | |
no_test 1852549/s 0% -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment