[tracker/wip/carlosg/update-perf: 16/43] 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: 16/43] libtracker-sparql/core: Do not clear all cached graph info between updates
- Date: Wed, 24 Aug 2022 00:49:49 +0000 (UTC)
commit c1e99c75a8c57f31467e9449c6507f0938368f11
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 a806a9f54..32b7f4a71 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;
@@ -2769,7 +2779,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]