in reply to Re^4: Curious find while comparing grep, map, and smart match...
in thread Curious find while comparing grep, map, and smart match...
but in this instance he was wrong.
Really? I added this sub:
sub shuffleEm { ( shuffle 1 .. $range )[ 0 .. $uSize ]; }
To your benchmark:
cmpthese( -1, { grepGen => sub{ @grep = grepGen(); }, mapGen => sub{ @map = mapGen(); }, smartGen => sub{ @smart = smartGen(); }, shuffleEm=> sub{ @shuffled = shuffleEm() }, } );
And got these times:
C:\test>junk Rate grepGen mapGen smartGen shuffleEm grepGen 35.3/s -- -51% -97% -100% mapGen 72.6/s 106% -- -94% -100% smartGen 1250/s 3439% 1621% -- -95% shuffleEm 26859/s 75977% 36902% 2049% --
And that doesn't include the time and memory you waste building your pointless pool of 1M values.
But hey. It's your time you are wasting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Curious find while comparing grep, map, and smart match...
by dbuckhal (Chaplain) on Mar 27, 2013 at 17:19 UTC | |
by space_monk (Chaplain) on Mar 27, 2013 at 17:46 UTC | |
by dbuckhal (Chaplain) on Mar 27, 2013 at 19:17 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2013 at 17:45 UTC | |
by dbuckhal (Chaplain) on Mar 27, 2013 at 18:50 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2013 at 20:37 UTC | |
by dbuckhal (Chaplain) on Mar 28, 2013 at 02:31 UTC |