struct FirstCharsStringHash
{
size_t operator()(const OUString& str) const
{ // Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, // and computing an entire hash could almost negate the gain of hashing. Hash just first // characters, that should be good enough.
size_t hash
= rtl_ustr_hashCode_WithLength(str.getStr(), std::min<size_t>(100, str.getLength()));
o3tl::hash_combine(hash, str.getLength()); return hash;
}
};
struct FastStringCompareEqual
{ booloperator()(const OUString& str1, const OUString& str2) const
{ // Strings passed to GenericSalLayout::CreateTextLayoutCache() may be very long, // and OUString operator == compares backwards and using hard-written code, while // memcmp() compares much faster. if (str1.getLength() != str2.getLength()) returnfalse; if (str1.getStr() == str2.getStr()) returntrue; return memcmp(str1.getStr(), str2.getStr(), str1.getLength() * sizeof(str1.getStr()[0]))
== 0;
}
};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.