diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-04-07 17:01:16 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-04-07 23:14:53 +0200 |
commit | c5199abfc1a468b28c680faf41e2f11bc1729c47 (patch) | |
tree | 464fbcf4583c82dc85683b94c5e544262aab1955 /external | |
parent | 26e09fb1d50ae137431c1b86a1178ad1286b4f62 (diff) |
work around ICU performance problem in text breaking (tdf#116400)
Reported upstream at https://unicode-org.atlassian.net/browse/ICU-21946 ,
they've confirmed the problem, but so far no actual code change. So
let's push my patch for now.
Change-Id: Idd92ca66eea9b28103ad890aec66c40029ec7ebd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132676
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'external')
-rw-r--r-- | external/icu/UnpackedTarball_icu.mk | 1 | ||||
-rw-r--r-- | external/icu/do-not-reset-useful-cache-to-empty-in-populateNear.patch.2 | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk index 58a05f1ee39b..25b4f1defa26 100644 --- a/external/icu/UnpackedTarball_icu.mk +++ b/external/icu/UnpackedTarball_icu.mk @@ -43,6 +43,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\ external/icu/icu4c-use-pkgdata-single-ccode-file-mode.patch.1 \ external/icu/icu4c-$(if $(filter ANDROID,$(OS)),android,rpath).patch.1 \ $(if $(filter-out ANDROID,$(OS)),external/icu/icu4c-icudata-stdlibs.patch.1) \ + external/icu/do-not-reset-useful-cache-to-empty-in-populateNear.patch.2 \ )) $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict)) diff --git a/external/icu/do-not-reset-useful-cache-to-empty-in-populateNear.patch.2 b/external/icu/do-not-reset-useful-cache-to-empty-in-populateNear.patch.2 new file mode 100644 index 000000000000..bd7fe74fb42a --- /dev/null +++ b/external/icu/do-not-reset-useful-cache-to-empty-in-populateNear.patch.2 @@ -0,0 +1,37 @@ +From 34b2f7174ba187d99dfb8704b9cf19d369accc13 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz> +Date: Wed, 16 Mar 2022 10:54:03 +0100 +Subject: [PATCH] do not reset useful cache to empty in populateNear() + +--- + icu4c/source/common/rbbi_cache.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/icu4c/source/common/rbbi_cache.cpp b/icu4c/source/common/rbbi_cache.cpp +index 26d82df781..54a77c97c6 100644 +--- a/icu/source/common/rbbi_cache.cpp ++++ b/icu/source/common/rbbi_cache.cpp +@@ -352,7 +352,7 @@ UBool RuleBasedBreakIterator::BreakCache + if ((position < fBoundaries[fStartBufIdx] - 15) || position > (fBoundaries[fEndBufIdx] + 15)) { + int32_t aBoundary = 0; + int32_t ruleStatusIndex = 0; +- if (position > 20) { ++ if (position > 20 && false) { // handleSafePrevious() is broken and always returns 0 + int32_t backupPos = fBI->handleSafePrevious(position); + + if (backupPos > 0) { +@@ -376,7 +376,10 @@ UBool RuleBasedBreakIterator::BreakCache::populateNear(int32_t position, UErrorC + ruleStatusIndex = fBI->fRuleStatusIndex; + } + } +- reset(aBoundary, ruleStatusIndex); // Reset cache to hold aBoundary as a single starting point. ++ // Reset cache to hold aBoundary as a single starting point. ++ // Do not do so if what's in the cache is still more useful than an empty cache. ++ if (!(aBoundary == 0 && position > fBoundaries[fEndBufIdx])) ++ reset(aBoundary, ruleStatusIndex); + } + + // Fill in boundaries between existing cache content and the new requested position. +-- +2.34.1 + |