in reply to Re^4: What are the other option for sorting the keys of hash of hashes
in thread What are the other option for sorting the keys of hash of hashes
Anyway, I have added code to benchmark the sorting algorithms provided by Sort::Key and Sort::Key::Radix...
... use Sort::Key::Radix; my $skr = sub { my @sortedKeys = Sort::Key::Radix::nkeysort { $hash{$_}{Size} +} keys %hash }; use Sort::Key; my $sk = sub { my @sortedKeys = Sort::Key::nkeysort { $hash{$_}{Size} } keys +%hash }; cmpthese( -5, { ClassicGRT => $rcClassicGRT, ClassicST => $rcClassicST, Jethro => $rcJethro, Simple => $rcSimple, SK => $sk, SKR => $skr } );
Rate Simple ClassicST ClassicGRT Jethro SK + SKR Simple 3.08/s -- -45% -69% -70% -78% + -80% ClassicST 5.64/s 83% -- -42% -45% -60% + -63% ClassicGRT 9.79/s 218% 74% -- -5% -31% + -36% Jethro 10.3/s 234% 83% 5% -- -27% + -32% SK 14.1/s 359% 151% 44% 37% -- + -7% SKR 15.2/s 394% 170% 55% 48% 8% + --
|
|---|