D and Nim

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 17:29:57 PST 2015


On 1/4/2015 5:07 PM, weaselcat wrote:
> It doesn't time that part

You're right, I overlooked that.

You can also speed things up by noticing that the nodes[] and visited[] 
arguments never change, so getLongestPath can be made as a nested function with 
those arrays as locals in the enclosing function.

This will reduce stack consumption, improving cache performance, and nodeID will 
get passed in a register.


More information about the Digitalmars-d mailing list