> DUPRE Christophe <duprec@jsp.umontreal.ca> wrote:
[ ... ]
>> So the one-list solution might use a bit more memory (though not
>> much), add a flag clear, and slow down the "scavenger" in it's job
>> because it needs to walk the list.
> You can do with one list. Take zeroed structures from the head,
> and put used non-zeroed structures at the end. You just need a
> pointer to the first non-zeroed structure in the list, so the
> "scavenger" knows where to start zeroing, and you can check whether
> you are out of zeroed structures. Or you can add non-zeroed after
> the first non-zeroed (so you don't need a pointer to the end).
The biggest problem at the moment appears to be the overhead in moving
items around the list, rather than actually searching the
list. Removing all the move operations, and searching from the item
after the last item it found made it nearly 100 times faster. I
couldn't say for certain that it was the move operations slowing it
down, but the old code appears to keep unused items at the head of the
list almost all the time.
Re using idle to clean the list: this is only a win if there is idle
time to spare. You risk catatrophic breakdowns relying on idle
time. If the idle time drops, the scavenger gets less time, which
makes list operations take longer, which drops the idle time, .... and
next thing you know, you're at worst case behaviour for extended
periods of time.
Michael.