[tracker/wip/carlosg/update-perf: 34/61] libtracker-sparql/core: Do not clear all cached graph info between updates
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 34/61] libtracker-sparql/core: Do not clear all cached graph info between updates
- Date: Mon, 22 Aug 2022 22:07:43 +0000 (UTC)
commit eb995c0c8f07d03b5b624dde054e92e221f9f2b2
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Aug 2 23:50:34 2022 +0200
libtracker-sparql/core: Do not clear all cached graph info between updates
Since graphs don't change often, we can preserve the cached information for
these, most importantly the prepared statements to update refcounts.
We now instead clear the contents of the TrackerDataUpdateBufferGraph,
preserving the things we want to preserve.
src/libtracker-sparql/core/tracker-data-update.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index 528f19c14..00cfa3b48 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -1345,10 +1345,12 @@ tracker_data_update_buffer_flush (TrackerData *data,
g_propagate_error (error, actual_error);
goto out;
}
+
+ g_hash_table_remove_all (graph->resources);
+ g_hash_table_remove_all (graph->refcounts);
}
out:
- g_ptr_array_set_size (data->update_buffer.graphs, 0);
g_hash_table_remove_all (data->update_buffer.new_resources);
data->resource_buffer = NULL;
}
@@ -1374,7 +1376,15 @@ tracker_data_update_buffer_might_flush (TrackerData *data,
static void
tracker_data_update_buffer_clear (TrackerData *data)
{
- g_ptr_array_set_size (data->update_buffer.graphs, 0);
+ TrackerDataUpdateBufferGraph *graph;
+ guint i;
+
+ for (i = 0; i < data->update_buffer.graphs->len; i++) {
+ graph = g_ptr_array_index (data->update_buffer.graphs, i);
+ g_hash_table_remove_all (graph->resources);
+ g_hash_table_remove_all (graph->refcounts);
+ }
+
g_hash_table_remove_all (data->update_buffer.new_resources);
g_hash_table_remove_all (data->update_buffer.resource_cache);
data->resource_buffer = NULL;
@@ -2767,7 +2777,6 @@ tracker_data_commit_transaction (TrackerData *data,
tracker_db_interface_execute_query (iface, NULL, "PRAGMA cache_size = %d",
TRACKER_DB_CACHE_SIZE_DEFAULT);
- g_ptr_array_set_size (data->update_buffer.graphs, 0);
g_hash_table_remove_all (data->update_buffer.resource_cache);
tracker_data_dispatch_commit_statement_callbacks (data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]