[Evolution-hackers] libebook scalability



I discovered a bottleneck for addressbook performance with large
addressbooks. Details at
http://n800evolution.blogspot.com/2007/04/libebook-scalability.html

A proposed fix is attached. I'm not sure if order matters when
returned from the backend? Does anyone know? If not, g_list_reverse
can be omitted.

Øystein
--- addressbook/backends/file/e-book-backend-file.c.orig	2007-04-02 00:42:20.871493559 +0200
+++ addressbook/backends/file/e-book-backend-file.c	2007-04-02 00:43:08.298457559 +0200
@@ -412,7 +412,7 @@
 
 			db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
 			if (db_error == 0) {
-				contact_list = g_list_append (contact_list, vcard_dbt.data);
+				contact_list = g_list_prepend (contact_list, vcard_dbt.data);
 			} else {
 				g_warning (G_STRLOC ": db->get failed with %d", db_error);
 				status = GNOME_Evolution_Addressbook_OtherError ;
@@ -451,7 +451,7 @@
 			    || strcmp (id_dbt.data, E_BOOK_BACKEND_FILE_VERSION_NAME)) {
 
 				if ((!search_needed) || (card_sexp != NULL && e_book_backend_sexp_match_vcard  (card_sexp, vcard_dbt.data))) {
-					contact_list = g_list_append (contact_list, vcard_dbt.data);
+					contact_list = g_list_prepend (contact_list, vcard_dbt.data);
 				}
 			}
 
@@ -473,6 +473,7 @@
 		}
 	}
 
+	contact_list = g_list_reverse (contact_list);
 	*contacts = contact_list;
 	return status;
 }


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