[m-dev.] Idea for reducing cost of heap allocation

Ralph Becket rbeck at microsoft.com
Thu May 3 19:22:05 AEST 2001


> From: Fergus Henderson [mailto:fjh at cs.mu.OZ.AU]
> Sent: 02 May 2001 22:24
> 
> That assumes that the cost of checking this cache is zero.
> But it's not.  For a sufficiently efficient collector,
> the cost of checking the cache will be similar to the
> cost of doing a memory allocation (which is just checking
> a free list).

No, I was assuming a few machine cycles to check a free-list of
cells of the appropriate size.  Looking at the source, 
GC_malloc_inner seems to perform quite a lot of work for each 
call that would be common to all calls allocating the same cell 
size.  You're right though, the overhead of calling GC_malloc
inline with fixed arguments is minimal, providing the C compiler
eliminates all the chaff in there.

> and then generate calls to GC_malloc_1_word(), etc.
> This gets the benefit of --inline-alloc, with negligable space cost.

Anybody up for trying this one out?

- Ralph
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list