[Users] [PATCH] Optimize remove_numbered_files_not_in_list() complexity from O(n^2) to O(n)

Igor Mammedov imammedo at redhat.com
Wed Oct 10 09:51:30 CEST 2012


On Wed, 10 Oct 2012 08:51:26 +0200
Colin Leroy <colin at colino.net> wrote:

> On 10 October 2012 at 00h08, Michael Rasmussen wrote:
> 
> Hi, 
> 
> Thanks Igor, I love this kind of patches where minimal changes make
> things a whole lot faster. Keep them coming :)
> 
> Thanks Michael for the seg fix.
> 
> Just one thing:
> 
> > +	    if (g_hash_table_lookup(file_no_tbl, numberlist->data)) {
> > +		debug_print("removing unwanted file %d from %s\n",
> > 			GPOINTER_TO_INT(numberlist->data), dir);
> 
> Isn't that reversed? It's supposed to remove files *not* in list. Or am
> I still asleep? :)
Opps,
 Nope you are very much awake, it was me who had been asleep.
it should be:

   if (!g_hash_table_lookup(file_no_tbl, numberlist->data)) {





More information about the Users mailing list