Can this implementation of Damm algorithm be optimized?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 9 14:08:46 PST 2017


On 02/09/2017 02:04 PM, Nestor wrote:

 > I tried running each algoritm a few times through avgtime using
 > different digit lengths

avgtime profiles the whole process, right? It measures everything that 
is involved in that little program. At least OS starting the program, D 
runtime initializing, program interacting with the console, etc.

Since you're comparing algorithms, you need to take everything else out 
of the equation. A better approach is to use std.datetime.benchmark, 
which would repeat just the algorithm that you're interested in.

Ali



More information about the Digitalmars-d-learn mailing list