proposal for optimization in Unicode comparisons
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
New
|
Medium
|
Sorin Marian Nasoi |
Bug Description
I had a look today into the ICU documentation and I found something that I think we can use to optimize our usage of ICU:
Starting with ICU 4.2 they introduced
http://
that handle UTF-8 strings comparisons
This means that we do not need to do conversions from
"const char*" (our UTF-8 encoded strings) to
"UnicodeString" (ICU's internal UTF-16 strings)
for comparing 2 strings using ICU.
So, instead of using:
Collator:
we can use:
Collator:
What I propose is this:
- if the user has linked against ICU version greater or equal to 4.2, use the "StringPiece" class
- if the ICU version is less then 4.2, keep current behaviour for example, in src/util/
unicode::string us1;
unicode::string us2;
unicode:
unicode:
Collator:
result = static_
return result;
do
::UCollationResult result = ::UCOL_EQUAL ;
UErrorCode status = U_ZERO_ERROR;
result = static_
s2.c_str(), status);
if(U_FAILURE(
{
assert(false);
}
return result;
tags: | removed: runtime |