D and Nim

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 18:07:50 PST 2015


On Monday, 5 January 2015 at 01:30:08 UTC, Walter Bright wrote:
> 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.

Small improvement but almost put it equal to C++/gcc, also 
greatly sped up GDC weirdly(not quite LDC speed though)


More information about the Digitalmars-d mailing list