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



commit 315a5b49239ada2dfb035f2f0d40ccadd3330995
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]