Re: GSList speed



On Wed, Aug 07, 2002 at 02:47:39PM +0200, Janus N. Tøndering wrote:
Hi,

I was wondering, since it isn't mentioned in the API reference, how fast
GSList is? Does g_slist_append() run in constant time? Or does it search
for the last item each time? And how about the other functions that
manipulate lists?

Thank you.

Regards,
Janus N. Tøndering
-- 
Janus Nørgaard Tøndering      
email: j nus person dk or u011014 daimi au dk

"Would you buy a car with the hood welded shut?"
-Phil Hughes, Linux Journal Magazine


Hi,

If you check out glib/gslist.c and glib/glist.c you'll see that the
append functions call g_slist_last and g_list_last (respectively for
GSList and GList) which loop through each element making appending
linear time.  For the rest of the functions just check out the source,
the lists are simple and pretty easy to follow.

-Scott

-- 
We are not humanity.
-B



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