Can this implementation of Damm algorithm be optimized?

Nestor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 10 03:27:02 PST 2017


On Thursday, 9 February 2017 at 23:49:19 UTC, Era Scarecrow wrote:
>  Other optimizations could be to make it multiple levels, 
> taking the basic 100 elements and expanding them 2-3 levels 
> deep in a lookup and having it do it in more or less a single 
> operation. (100 bytes for 1 level, 10,000 for 2 levels, 
> 1,000,000 for 3 levels, 100,000,000 for 4 levels, etc), but the 
> steps of converting it to the array lookup won't give you that 
> much gain, although fewer memory lookups but none of them will 
> be cached, so any advantage from that is probably lost. 
> Although if you bump up the size to 16x10 instead of 10x10, you 
> could use a shift instead of *10 which will make that slightly 
> faster (there will be unused empty padded spots)
>
>  In theory if you avoid the memory lookup at all, you could 
> gain some amount of speed, depending on how it searches a 
> manual table, although using a switch-case and a mixin to do 
> all the details it feels like it wouldn't give you any gain...

Thank you for the detailed reply. I wasn't able to follow you 
regarding the multilevel stuff though :(


More information about the Digitalmars-d-learn mailing list