Can this implementation of Damm algorithm be optimized?

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 11 13:56:54 PST 2017


On Saturday, 11 February 2017 at 21:41:11 UTC, Era Scarecrow 
wrote:
>  But it seriously is a lot of overhead for such a simple 
> function.

  Just ran the unittests under the dmd profiler, says the 
algorithm is 11% faster now. So yeah slightly more optimized. 
Another level and we could probably get 25%, but the built matrix 
will blow up far larger than the 10k it is now.

   Num          Tree        Func        Per
   Calls        Time        Time        Call
12000000     1281989     1281989           0     char 
damm.checkDigit(immutable(char)[])
12000000     1146308     1146308           0     char 
damm.checkDigit2(immutable(char)[])




More information about the Digitalmars-d-learn mailing list