summaryrefslogtreecommitdiff
path: root/libs/minikin/HyphenatorMap.cpp
diff options
context:
space:
mode:
authorSeigo Nonaka <nona@google.com>2018-02-06 20:33:10 -0800
committerSeigo Nonaka <nona@google.com>2018-02-07 21:22:00 +0000
commite614a45a28cccdf289361e68f2b8ca3a2f17e84e (patch)
tree0979e6fdfdafbccbd14b291dbfaa9391bddabc7b /libs/minikin/HyphenatorMap.cpp
parent4de86391218f9fa2d1ba15d78cd80514fb5ce43d (diff)
downloadminikin-e614a45a28cccdf289361e68f2b8ca3a2f17e84e.tar.gz
Use own mutex for guarding hyphenator map
To be independent from gMinikinLock, introduce own private mutex for guarding mMap in HyphenatorMap. Here is a raw performance score of walleye-userdebug: StaticLayout creation time MeasuredText Balanced Hyphenation : 707,498 -> 704,994: (-0.4%) MeasuredText Balanced NoHyphenation: 534,300 -> 539,847: (+1.0%) MeasuredText Greedy Hyphenation : 490,890 -> 494,681: (+0.8%) MeasuredText Greedy NoHyphenation : 487,793 -> 488,553: (+0.2%) RandomText Balanced Hyphenation : 18,022,896 -> 18,148,346: (+0.7%) RandomText Balanced NoHyphenation : 7,556,794 -> 7,631,448: (+1.0%) RandomText Greedy Hyphenation : 7,501,910 -> 7,515,126: (+0.2%) RandomText Greedy NoHyphenation : 7,528,287 -> 7,575,344: (+0.6%) MeasuredText creation time NoStyled Hyphenation : 17,928,820 -> 18,004,921: (+0.4%) NoStyled Hyphenation WidthOnly : 17,424,962 -> 17,459,350: (+0.2%) NoStyled NoHyphenation : 7,535,558 -> 7,601,492: (+0.9%) NoStyled NoHyphenation WidthOnly : 7,083,235 -> 7,122,189: (+0.5%) Styled Hyphenation : 14,739,424 -> 14,961,242: (+1.5%) Styled Hyphenation WidthOnly : 13,890,818 -> 14,067,121: (+1.3%) Styled NoHyphenation : 14,369,931 -> 14,470,800: (+0.7%) Styled NoHyphenation WidthOnly : 13,442,347 -> 13,568,743: (+0.9%) StaticLayout draw time MeasuredText NoStyled : 658,746 -> 658,118: (-0.1%) MeasuredText NoStyled WithoutCache : 655,302 -> 654,450: (-0.1%) MeasuredText Styled : 884,692 -> 897,991: (+1.5%) MeasuredText Styled WithoutCache : 902,174 -> 911,318: (+1.0%) RandomText NoStyled : 569,104 -> 574,551: (+1.0%) RandomText NoStyled WithoutCache : 6,853,407 -> 6,918,073: (+0.9%) RandomText Styled : 2,953,835 -> 2,978,776: (+0.8%) RandomText Styled WithoutCache : 3,392,726 -> 3,402,067: (+0.3%) Bug: 37567215 Test: minikin Change-Id: I833c23a0dcb7a86d69c50840d66dadb57072c94a
Diffstat (limited to 'libs/minikin/HyphenatorMap.cpp')
-rw-r--r--libs/minikin/HyphenatorMap.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/minikin/HyphenatorMap.cpp b/libs/minikin/HyphenatorMap.cpp
index 0c3592d..7e41206 100644
--- a/libs/minikin/HyphenatorMap.cpp
+++ b/libs/minikin/HyphenatorMap.cpp
@@ -47,7 +47,7 @@ HyphenatorMap::HyphenatorMap()
void HyphenatorMap::addInternal(const std::string& localeStr, const Hyphenator* hyphenator) {
const Locale locale(localeStr);
- android::AutoMutex _l(gMinikinLock);
+ std::lock_guard<std::mutex> lock(mMutex);
addInternalLocked(locale, hyphenator);
}
@@ -58,14 +58,14 @@ void HyphenatorMap::addInternalLocked(const Locale& locale, const Hyphenator* hy
}
void HyphenatorMap::clearInternal() {
- android::AutoMutex _l(gMinikinLock);
+ std::lock_guard<std::mutex> lock(mMutex);
mMap.clear();
}
void HyphenatorMap::addAliasInternal(const std::string& fromLocaleStr,
const std::string& toLocaleStr) {
const Locale fromLocale(fromLocaleStr);
const Locale toLocale(toLocaleStr);
- android::AutoMutex _l(gMinikinLock);
+ std::lock_guard<std::mutex> lock(mMutex);
auto it = mMap.find(toLocale.getIdentifier());
if (it == mMap.end()) {
ALOGE("Target Hyphenator not found.");
@@ -76,7 +76,7 @@ void HyphenatorMap::addAliasInternal(const std::string& fromLocaleStr,
const Hyphenator* HyphenatorMap::lookupInternal(const Locale& locale) {
const uint64_t id = locale.getIdentifier();
- android::AutoMutex _l(gMinikinLock);
+ std::lock_guard<std::mutex> lock(mMutex);
const Hyphenator* result = lookupByIdentifierLocked(id);
if (result != nullptr) {
return result; // Found with exact match.