Re: [Fwd: glib::GList:g_list_append(), g_list_last() performance problem]



Andrew Bartle / 93011 <a_bartle stest ch> writes: 
> Given the excellent work that has already gone into memory chunk allocation
> etc. to optimise list performance, do you think that hiding this small change
> in the list itself is worth the effort ?
> 

As Owen says, you could use GQueue in this case. It isn't worth the
effort for the list, if for no other reason that it breaks a lot of
existing code.

Also though, there are tradeoffs. The virtue of this list
implementation is that all nodes are equal; the list is just a node,
as in lisp. i.e. instead of a List object with a pointer to some
Nodes, we have just a Node/List combination object.

To cache the tail, you'd have to do it on every node. That uses a lot
of memory, and makes manipulating the nodes painful, negating much of
the value of the recursive all-nodes-are-lists-are-nodes design.

Havoc




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