On Wednesday, 18 September 2013 at 13:39:29 UTC, bearophile wrote:
auto centrality =
centrality = T0;
auto stack = new size_t[g.vertexCount];
auto sigma = minimallyInitializedArray!T(g.vertexCount);
sigma = T0;
auto delta = minimallyInitializedArray!T(g.vertexCount);
delta = T0;
auto d = minimallyInitializedArray!long(g.vertexCount);
d = -1;
auto q = VertexQueue(g.vertexCount);
auto p = new Appender!(size_t)[g.vertexCount];
As an experiment I tried something along these lines -- using
uninitializedArray for most of the arrays here and
minimallyInitializedArray for p.
It seems to result in a small speed improvement, although I'm not
certain about that -- certainly not a speed loss.
On the other hand, if inside the VertexQueue implementation, I
replace the "new" declaration with an uninitializedArray call,
the code gets slower by a noticeable amount.
Very odd -- any ideas why that might be?