Timon Gehr:

> I have already tried that, but my machine starts swapping and therefore 
> I don't get the speedup.

I have "only 2" GB of RAM. I suggest you to just reduce the number, so instead 
of 1_000_000, to use a smaller number, like 500_000, or smaller.


> What kind of GC would be fastest for that use case?

I am not an expert of GC, but there are tens of different kinds of GCs. I 
presume a GC that doesn't need to follow the chains is more efficient in this 
case (Time ago two persons were searching for D GC benchmarks. I suggest them 
to add this little program to their set of benchmarks). But sometimes it's not 
bad to give hints n some way to the GC, and change its working strategy for a 
small piece of code where the programmer knows a large data structure will be 
built in a focused way.


> Is the current GC 
> repeatedly looping over all allocated memory blocks to find the next 
> link to follow?

I think it is doing something like that.

Bye,
bearophile

Reply via email to