| 1 | package Bencher::Scenario::SortHashKeys; | ||
| 2 | |||
| 3 | 1 | our $DATE = '2017-05-24'; # DATE | |
| 4 | 1 | our $VERSION = '0.001'; # VERSION | |
| 5 | |||
| 6 | 1 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | our $scenario = { | ||
| 11 | summary => 'Benchmark Sort::HashKeys', | ||
| 12 | participants => [ | ||
| 13 | { | ||
| 14 | name => 'map', | ||
| 15 | code_template => 'state $h = <hash>; map {($_, $h->{$_})} sort keys %$h', | ||
| 16 | result_is_list => 1, | ||
| 17 | }, | ||
| 18 | { | ||
| 19 | module => 'Sort::HashKeys', | ||
| 20 | function => 'sort', | ||
| 21 | code_template => 'state $h = <hash>; Sort::HashKeys::sort(%$h)', | ||
| 22 | result_is_list => 1, | ||
| 23 | }, | ||
| 24 | ], | ||
| 25 | datasets => [ | ||
| 26 | 2 | {name=>'2key' , args=>{hash=>{map {$_=>1} 1.. 2}} }, | |
| 27 | 10 | {name=>'10key' , args=>{hash=>{map {$_=>1} 1.. 10}} }, | |
| 28 | 1 | {name=>'100key', args=>{hash=>{map {$_=>1} 1..100}} }, | |
| 29 | ], | ||
| 30 | }; | ||
| 31 | |||
| 32 | 1 | 1; | |
| 33 | # ABSTRACT: Benchmark Sort::HashKeys | ||
| 34 | |||
| 35 | __END__ | ||