Descriptionbase/i18n: Class for efficiently searching the same query over many texts.
StringSearchIgnoringCaseAndAccents (implemented by ICU's usearch_* family)
takes significantly long time for preprocessing the query text. Thus, when
we want to query over multiple different texts with the same query,
it becomes much more efficient if we reuse the preprocessed query.
Here's the super micro benchmark result:
TEST(StringSearchTest, BenchmarkOld) {
string16 query(ASCIIToUTF16("hello"));
string16 text(ASCIIToUTF16("hello"));
for (int i = 0; i < 1000000; ++i)
StringSearchIgnoringCaseAndAccents(query, text, NULL, NULL);
}
TEST(StringSearchTest, BenchmarkNew) {
FixedPatternStringSearchIgnoringCaseAndAccents query(ASCIIToUTF16("hello"));
string16 text(ASCIIToUTF16("hello"));
for (int i = 0; i < 1000000; ++i)
query.Search(text, NULL, NULL);
}
[ RUN ] StringSearchTest.BenchmarkOld
[ OK ] StringSearchTest.BenchmarkOld (68230 ms)
[ RUN ] StringSearchTest.BenchmarkNew
[ OK ] StringSearchTest.BenchmarkNew (1282 ms)
BUG=255269
TEST=base_unittests --gtest_filter='StringSearchTest.*'
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=211052
Patch Set 1 #
Total comments: 2
Patch Set 2 : Address review comments (#5) #
Messages
Total messages: 9 (0 generated)
|