[epiphany/history-rewrite: 28/45] EphyHistoryService: optimize find_visit_rows()
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/history-rewrite: 28/45] EphyHistoryService: optimize find_visit_rows()
- Date: Wed, 24 Aug 2011 19:41:40 +0000 (UTC)
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]