Re: Speed improvement of g_list_append



On Wed, Jun 20, 2001 at 03:36:37PM +0200, Pawel Salek wrote:
> 
> On 2001-06-20 08:01 Emmanuel wrote:
>> 	Hi,
>> Still on the g_list_append thing :)
>> We could just keep track of the current last element and append after 
>> it, in this case, because current_last->next==NULL, g_list_append()
>> will just update current_last->next and won't traverse all the list.
>> Here is  the code
>> [...]
> 
> My *very personal* opinion is that it is just not worth it. 
> 1. the code becomes less readable.
> 2. the scaling is still the same (proportional to the list length) and
> the speed gain is questionable.
> 
> "Keep it simple".

Perhaps this could be revisited when glib 2.0 comes out and the GQueue
could be used instead of a GList.  This should give the same speed
improvements with no readability problems:

http://developer.gnome.org/doc/API/2.0/glib/glib-double-ended-queues.html

cheers,
Charles




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