[tracker] parser: Optimize 0-length string parsing
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] parser: Optimize 0-length string parsing
- Date: Tue, 21 Jul 2015 21:17:45 +0000 (UTC)
commit 3eecd6f1bcadd7b9d46220ca111e91e8daf83822
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jul 20 03:12:37 2015 +0200
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
src/libtracker-common/tracker-parser-libicu.c | 3 +++
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 b26722c..493f864 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]