Implementing and optimizing a simple graph metric
bearophile
bearophileHUGS at lycos.com
Wed Sep 18 10:13:27 PDT 2013
Joseph Rushton Wakeling:
> in the case of this code I think that stack vs. heap probably
> isn't that important. If the data is small enough for stack
> allocation, the calculation will be quick anyway.
How many times or how often do you need to call betweenness()? If
it's called only few times or once in a while then using the GC
is good enough. But if you have to call it many millions of
times, all those GC array allocations could cost some time, even
if they are small arrays. In this case allocating them on the
stack (or not allocating them, using externally allocated
buffers) helps.
Bye,
bearophile
More information about the Digitalmars-d-announce
mailing list