in reply to Re: Speeding permutation counting
in thread Speeding permutation counting

Yes, this is the correct interpretation of my question, and thanks for your suggestions. I benchmarked your two suggestions relative to my original, and things are definitely improved:
Rate orig substring blokhead blokchop orig 1199/s -- -45% -62% -69% substring 2162/s 80% -- -31% -44% blokhead 3144/s 162% 45% -- -18% blokchop 3840/s 220% 78% 22% --
"Substring" is closer to my original (too verbose) style, so some of the gains are also coming from the more succinct, easier to read code. Best so far is the "chop" based suggestion.

Still wondering if there might be other improvements, or some vastly different way to solve this.

Thanks for these suggestions, they really have helped.
-a

Replies are listed 'Best First'.
Re^3: Speeding permutation counting
by ikegami (Patriarch) on Jul 18, 2007 at 15:44 UTC

    Do you have the benchmark code? I consider benchmark results useless without the accompanying benchmark code.

    It's also stopping us from comparing our own solutions without redoing all your work.

    If you're worried about the space it takes, use <readmore> or <spoiler> tags.

      Yeah, it was a space concern. Took things right from the solutions, and code includes other things I was testing (and your suggestion as well).

      Details...

        It's already bad enough that the code being benchmark is in a sub. Adding another sub in the call chain hurts that much more. To remove the extra sub call, use

        blokchop => \&blokchop, orig => \&orig, browserUK => \&browserUK, ikegami => \&ikegami,