More embarrassing microbenchmars for D's GC.

Leandro Lucarella llucax at gmail.com
Tue Jun 10 07:28:46 PDT 2008


Sean Kelly, el  9 de junio a las 22:53 me escribiste:
> == Quote from Leandro Lucarella (llucax at gmail.com)'s article
> > But there are a few other results I can't explain:
> > 1) Why is D gc (disabled or not) version ~25% slower than the D version
> >    that uses malloc when iterating the list? It shouldn't be any GC
> >    activity in that part. Could be some GC locallity issue that yields
> >    more cache misses?
> 
> I think it may have more to do with the allocation strategy in the GC.  It obtains
> memory in chunks from the OS, and each chunk is typically a max of 8MB.  So
> for a test like this the D GC will end up hitting the OS quite a few times asking
> for more memory.  If I had to guess I'd say that malloc has a more efficient
> strategy here.  If you're interested, try running the same test using Tango
> with and without a call tol tango.core.Memory.GC.reserve() for the amount of
> memory you expect the app to use before the loop.

Really? I though it was more collecion-related. I don't know exactly how
the D GC is implemented, but I thought that, as you say, it allocates a
chunk of memory, with each new it gave you a piece of that memory, and
when it ran out of memory, it runs a collection cycle. When that cycle
can't recover unused memory, allocates more.

Considering that the version with GC disabled is almost as fast as the
malloc version, and that the time grows exponentially (graph attached)
with the number of nodes, it looks like the problem is the GC
collection cycles to me. Is the GC algorithm exponential?

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Me encanta el éxito; por eso prefiero el estado de progreso constante,
con la meta al frente y no atrás.
	-- Ricardo Vaporeso. Punta del Este, Enero de 1918.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graph.pdf
Type: application/pdf
Size: 7758 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080610/6a618f83/attachment.pdf>


More information about the Digitalmars-d mailing list