[tracker/wip/miner-priority-queues: 17/19] libtracker-miner: slightly improve IRI cache performance



commit c5ccf7c2fa24170f5963a4a74df3891c09dbec18
Author: Carlos Garnacho <carlos lanedo com>
Date:   Wed Jul 6 14:48:32 2011 +0200

    libtracker-miner: slightly improve IRI cache performance
    
    For most cases, fs->priv->current_iri_cache_parent_urn has the
    parent folder URN, so just use it in the query when filling in
     the IRI cache.

 src/libtracker-miner/tracker-miner-fs.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index fdaf973..1f68f1b 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1483,12 +1483,20 @@ ensure_iri_cache (TrackerMinerFS *fs,
 
 	g_debug ("Generating children cache for URI '%s'", uri);
 
-	query = g_strdup_printf ("SELECT ?url ?u { "
-	                         "  ?u nfo:belongsToContainer ?p ; "
-	                         "     nie:url ?url . "
-	                         "  ?p nie:url \"%s\" "
-	                         "}",
-	                         uri);
+	if (fs->priv->current_iri_cache_parent_urn) {
+		query = g_strdup_printf ("SELECT ?url ?u { "
+					 "  ?u nfo:belongsToContainer <%s> ; "
+					 "     nie:url ?url "
+					 "}",
+					 fs->priv->current_iri_cache_parent_urn);
+	} else {
+		query = g_strdup_printf ("SELECT ?url ?u { "
+					 "  ?u nfo:belongsToContainer ?p ; "
+					 "     nie:url ?url . "
+					 "  ?p nie:url \"%s\" "
+					 "}",
+					 uri);
+	}
 
 	data.main_loop = g_main_loop_new (NULL, FALSE);
 	data.values = g_hash_table_ref (fs->priv->iri_cache);



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