On Thu, Mar 21, 2002 at 01:06:39PM +0200, Oded Arbel wrote: > I use list_extract_first to grab messages from the queue, and > list_append to add messages to the queue - both are very slow if the > list gets too long (a couple of handreds can cause noticable slowing). > except for calling list_len on every list_append, I don't use any other > list_ functions.
The weird thing is that neither of these operations should be affected by the length of the list. Lists use a circular buffer, so list_extract_first just moves the start pointer up by one, and list_append uses the next free entry in the buffer. You should only see a slowdown when the list is actually growing to a size bigger than it's ever been before, because then a new buffer is allocated. And even that should only happen when the buffer size has doubled, if you have an smart realloc() implementation. (The checking realloc is smart in that way.) Richard Braakman