Re: [gtk-list] Re: Benchmarking glib (atleast GList) (was: how ca n I trust glib when it has so many memleaks?)



damon@karuna.freeserve.co.uk wrote:
>> Which is another discussion all together. (I submitted an GQList
>> that encapsulated the GList that allowed efficient adding to the end,
>> but nobody wanted it :(  ).
>
>I don't like the current implementation of GList much either. I'd like to
>see a better one which remembered the tail and you didn't have to keep track
>of the head yourself.

I think the cool thing about the current implementation, which you loose with
this sort of encapsulation, is that empty-list is just NULL. This makes a lot
of init code much simpler. It also makes recursion down lists possible (no
list-info block to update). 

A datastructure with fast addition at either end isn't really a list, it's
more like a LIFO queue or something. Build it on top of GSList and call it
something else (GQueue?).

John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)171 930 2108
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]