in reply to Re^3: Can this code be optimized further?
in thread Can this code be optimized further?

Hmm.. Redefining makes a significant difference. That is odd, I didn't beleive that any of those functions where modifying the list. Which one is modifying the list?

C:\test>perl 429768.pl (warning: too few iterations for a reliable count) Rate Grep Grep + Map Hash Map Router Trinary Origi +nal Switch Grep 9699/s -- -36% -39% -42% -44% -47% - +52% -65% Grep + Map 15244/s 57% -- -5% -9% -12% -17% - +24% -45% Hash 16000/s 65% 5% -- -5% -8% -12% - +20% -43% Map 16835/s 74% 10% 5% -- -3% -8% - +16% -40% Router 17301/s 78% 13% 8% 3% -- -5% - +13% -38% Trinary 18282/s 88% 20% 14% 9% 6% -- +-9% -34% Original 20000/s 106% 31% 25% 19% 16% 9% + -- -28% Switch 27855/s 187% 83% 74% 65% 61% 52% +39% -- C:\test>perl 429768.pl Rate Grep Grep + Map Map Hash Router Trinary Origi +nal Switch Grep 9625/s -- -38% -41% -41% -45% -47% - +53% -66% Grep + Map 15420/s 60% -- -5% -5% -12% -16% - +25% -46% Map 16194/s 68% 5% -- -0% -8% -11% - +22% -43% Hash 16194/s 68% 5% 0% -- -8% -11% - +22% -43% Router 17544/s 82% 14% 8% 8% -- -4% - +15% -38% Trinary 18282/s 90% 19% 13% 13% 4% -- - +11% -36% Original 20640/s 114% 34% 27% 27% 18% 13% + -- -27% Switch 28450/s 196% 84% 76% 76% 62% 56% +38% --

___________
Eric Hodges

Replies are listed 'Best First'.
Re^5: Can this code be optimized further?
by RazorbladeBidet (Friar) on Feb 10, 2005 at 16:37 UTC
    Not sure - I'll check though.

    Here's my results - I have what you have, but no Grep + Map, and Switch is now Substr Hash (more flexible), plus added the suggestion for split (slightly modified).


    Rate Eval Grep Map REHash SplHash Router REEq Or +ig SubHash Eval 5522/s -- -35% -52% -54% -55% -58% -58% -6 +2% -72% Grep 8432/s 53% -- -26% -30% -32% -35% -36% -4 +2% -58% Map 11468/s 108% 36% -- -5% -8% -12% -13% -2 +1% -42% REHash 12092/s 119% 43% 5% -- -3% -7% -8% -1 +6% -39% SplHash 12407/s 125% 47% 8% 3% -- -5% -6% -1 +4% -38% Router 13055/s 136% 55% 14% 8% 5% -- -1% -1 +0% -34% REEq 13210/s 139% 57% 15% 9% 6% 1% -- - +8% -34% Orig 14430/s 161% 71% 26% 19% 16% 11% 9% +-- -27% SubHash 19881/s 260% 136% 73% 64% 60% 52% 50% 3 +8% --