[tracker/wip/carlosg/update-perf: 52/61] core: Optimize call to fetch property values




commit 8ee66fae010b89725aa0e830ac647fc330a9fa54
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Aug 20 19:02:07 2022 +0200

    core: Optimize call to fetch property values
    
    This is only necessary for properties with rdfs:Resource range,
    so only perform this operation for those.

 src/libtracker-sparql/core/tracker-data-update.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c 
b/src/libtracker-sparql/core/tracker-data-update.c
index 484ec87d4..50dc9b66e 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -2693,20 +2693,20 @@ delete_single_valued (TrackerData       *data,
                GError *inner_error = NULL;
                GArray *old_values;
 
-               old_values = get_property_values (data, predicate, &inner_error);
+               log_entry_for_single_value_property (data,
+                                                    tracker_property_get_domain (predicate),
+                                                    predicate, NULL);
 
-               if (old_values && old_values->len == 1) {
-                       GValue *value;
+               if (tracker_property_get_data_type (predicate) == TRACKER_PROPERTY_TYPE_RESOURCE) {
+                       old_values = get_property_values (data, predicate, &inner_error);
 
-                       value = &g_array_index (old_values, GValue, 0);
-                       log_entry_for_single_value_property (data,
-                                                            tracker_property_get_domain (predicate),
-                                                            predicate, NULL);
+                       if (old_values && old_values->len == 1) {
+                               GValue *value;
 
-                       if (tracker_property_get_data_type (predicate) == TRACKER_PROPERTY_TYPE_RESOURCE)
+                               value = &g_array_index (old_values, GValue, 0);
                                tracker_data_resource_unref (data, g_value_get_int64 (value), 
multiple_values);
-
-                       g_array_remove_index (old_values, 0);
+                               g_array_remove_index (old_values, 0);
+                       }
                } else {
                        /* no need to error out if statement does not exist for any reason */
                        g_clear_error (&inner_error);


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