base/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.*'

Review URL: https://chromiumcodereview.appspot.com/18031015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211052 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: df69c34f5cd77629afbc01053032c385848c9b01
3 files changed
tree: a02515c37a88ce005db35750e39361dd99509d8a
  1. base/
  2. build/
  3. dbus/
  4. ipc/
  5. testing/
  6. third_party/