Sparsity of deallocations

"Jon Harrop" <[email protected]> Tue, 4 Jan 2011 14:51:50 -0000
Newsgroups gmane.comp.programming.garbage-collection.general
Message-ID <004801cbac1e$ec358d40$c4a0a7c0$@com>
I have been studying garbage collection informally over the holidays again
and came up with some interesting results:

 
http://flyingfrogblog.blogspot.com/2010/12/towards-mark-region-gc-for-hlvm.h
tml
 
http://flyingfrogblog.blogspot.com/2011/01/boosts-sharedptr-up-to-10-slower-
than.html

I'd like to implement a kind of poor-man's mark region GC for my HLVM
project with the aim of attaining performance closer to OCaml on functional
code (where HLVM is 20x slower than OCaml) without sacrificing Java/C#-like
performance on imperative code (where HLVM is up to 6x faster than OCaml).

The essence of OCaml's efficiency in the context of functional code stems
from its use of a generational GC to allow many dead objects in the nursery
to be swept in constant time. So I've prototyped various schemes in C++
using a functional-style solution to solve the n-queens problem by
allocating lots of linked lists. The fastest stack-based solution is
actually doing an allocation every 36 nanoseconds (!). My region-based
solutions are around 2x slower than so I'm hoping to eat into that
performance gap by exploiting sparsity. Specifically, I believe that runs of
values that were contiguously allocated will be freed simultaneously and,
therefore, I should be able to exploit some of that sparsity by altering my
foundation to allow contiguous runs of values to be deallocated in a single
step rather than by deallocating each one in turn.

I was wondering if my conjecture has any known grounding and, in particular,
if anyone else has already gathered statistics on this kind of sparsity?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com