GC.disable;
size_t[size_t] unions;
foreach (line; "input.txt".File.byLineFast) {
line.munch(" \t"); // skip ws
immutable i = line.parse!size_t;
line.munch(" \t"); // skip ws
immutable j = line.parse!size_t;
unions[i] = j;
}
GC.enable;
}
A question for people that know something about the D garbage
collector: can it be added some logic to the GC to detect the
situations where you have to allocate many times very frequently,
and disable or rarefy the collection frequency, to increase the
code performance a lot? (I think "recently" the Python garbage
collector has added such optimization). This way that enabling
and disabling the GC becomes not needed any more.
Bye,
bearophile