[epiphany/history-rewrite: 28/45] EphyHistoryService: optimize find_visit_rows()



commit a1d40571225170882939f2212ceb321fcb00601b
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Jul 7 14:38:05 2011 +0300

    EphyHistoryService: optimize find_visit_rows()
    
    g_list_append() in a loop is slow. Use g_list_prepend() and
    g_list_reverse() instead.

 lib/history/ephy-history-service-visits-table.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/lib/history/ephy-history-service-visits-table.c b/lib/history/ephy-history-service-visits-table.c
index bd3e57b..7a182c4 100644
--- a/lib/history/ephy-history-service-visits-table.c
+++ b/lib/history/ephy-history-service-visits-table.c
@@ -126,8 +126,9 @@ ephy_history_service_find_visit_rows (EphyHistoryService *self, EphyHistoryQuery
   }
 
   while (ephy_sqlite_statement_step (statement, &error)) {
-    visits = g_list_append (visits, create_page_visit_from_statement (statement));
+    visits = g_list_prepend (visits, create_page_visit_from_statement (statement));
   }
+  visits = g_list_reverse (visits);
 
   if (error) {
     g_error ("Could not execute urls table query statement: %s", error->message);



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