summaryrefslogtreecommitdiff
path: root/src/libtracker-common
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2015-07-20 03:12:37 +0200
committerCarlos Garnacho <carlosg@gnome.org>2015-07-21 23:09:06 +0200
commit3eecd6f1bcadd7b9d46220ca111e91e8daf83822 (patch)
treedf27ad2ad780db26592c9bd21ee74d3a64c0bae7 /src/libtracker-common
parenta33816f29af384708f1bdf4478f95017dd756796 (diff)
downloadtracker-3eecd6f1bcadd7b9d46220ca111e91e8daf83822.tar.gz
parser: Optimize 0-length string parsing
We were still creating the ICU parser and trying to feed it with data, which turned out surprisingly expensive on deletes, as "deleting" on FTS just replaces the text with "nothing", so we're creating a parser for each of these. This reduces the timing of the sparql delete in the previous commit further down to: real 1m7.029s user 0m0.023s sys 0m0.009s
Diffstat (limited to 'src/libtracker-common')
-rw-r--r--src/libtracker-common/tracker-parser-libicu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libtracker-common/tracker-parser-libicu.c b/src/libtracker-common/tracker-parser-libicu.c
index b26722c96..493f864c8 100644
--- a/src/libtracker-common/tracker-parser-libicu.c
+++ b/src/libtracker-common/tracker-parser-libicu.c
@@ -651,6 +651,9 @@ tracker_parser_reset (TrackerParser *parser,
parser->cursor = 0;
+ if (parser->txt_size == 0)
+ return;
+
/* Open converter UTF-8 to UChar */
converter = ucnv_open ("UTF-8", &error);
if (!converter) {