in reply to Freed From the Tyranny of Math::BigInt

This common method was chosen because it's faster than doing a hash lookup or a method call to determine if something is allowed.

This thread should be retitled Why you shouldn't optimize prematurely. Did anyone ever look to see how much faster bitwise operations are over a hash lookup? And, frankly, you're doing a method call every time to call your permits() function. (A function is a method and the only overhead a method has is on the first you call it after @ISA is modified.)

If you had started with a hash or array, you would have scaled just fine. And, had you used vec (which is the Perlish way to do bitmasks, as merlyn pointed out), you would have scaled infinitely and had the speed benefits of bitmasking.

I'm not chastising you; I'm attempting to make sure others don't fall into the same trap you did.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

  • Comment on Re: Freed From the Tyranny of Math::BigInt

Replies are listed 'Best First'.
Re^2: Freed From the Tyranny of Math::BigInt
by friedo (Prior) on Feb 21, 2005 at 18:43 UTC
    I really don't know what was tried initially, as this stuff was written long, long before I started working on it.

    [id://merlyn]++'s suggestion is clearly much better than my idea (who knew you could do bitops on strings?! Not me. :) ). Oh, well. At least I got to mess around with overloading.