[tracker/wip/carlosg/perf-improvements: 4/5] libtracker-data: Avoid unescaping unichar characters if unneeded
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/perf-improvements: 4/5] libtracker-data: Avoid unescaping unichar characters if unneeded
- Date: Sat, 6 Jun 2020 12:39:18 +0000 (UTC)
commit f5c7cc660c309856bea10b232b3c96d981d2e90e
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jun 4 16:59:16 2020 +0200
libtracker-data: Avoid unescaping unichar characters if unneeded
Looking for unicode characters to unescape turns out a bit expensive on
multi-megabyte updates. Have a faster path for straight query copies if
there's no escaping sequence to be seen.
This turned out to be a fair chunk of time spent on tracker-miner-fs
first index.
5.39% 5.34% pool-tracker-mi libtracker-data.so [.] tracker_unescape_unichars
Now almost gone as unicode escaping characters are actually not that
much likely to happen often.
src/libtracker-data/tracker-sparql.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 9b023a129..63abf8055 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -8808,7 +8808,10 @@ tracker_sparql_new (TrackerDataManager *manager,
sparql = g_object_new (TRACKER_TYPE_SPARQL, NULL);
sparql->data_manager = g_object_ref (manager);
- sparql->sparql = tracker_unescape_unichars (query, -1);
+ if (strcasestr (query, "\\u"))
+ sparql->sparql = tracker_unescape_unichars (query, -1);
+ else
+ sparql->sparql = g_strdup (query);
tree = tracker_sparql_parse_query (sparql->sparql, -1, NULL,
&sparql->parser_error);
@@ -8989,7 +8992,10 @@ tracker_sparql_new_update (TrackerDataManager *manager,
sparql = g_object_new (TRACKER_TYPE_SPARQL, NULL);
sparql->data_manager = g_object_ref (manager);
- sparql->sparql = tracker_unescape_unichars (query, -1);
+ if (strcasestr (query, "\\u"))
+ sparql->sparql = tracker_unescape_unichars (query, -1);
+ else
+ sparql->sparql = g_strdup (query);
tree = tracker_sparql_parse_update (sparql->sparql, -1, &len,
&sparql->parser_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]