Skip to content

Commit

Permalink
Migrates uses of associative containers to more performant types.
Browse files Browse the repository at this point in the history
LSC doc: go/map-chooser-ga-lsc

MARKDOWN=true

Tested:
    TAP sample presubmit queue

PiperOrigin-RevId: 538802836
  • Loading branch information
Mozc team authored and hiroyuki-komatsu committed Jun 8, 2023
1 parent a13d56d commit 06b3da9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/data_manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ mozc_cc_library(
"//base:status",
"//base/container:serialized_string_array",
"@com_google_absl//absl/base:config",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/strings",
],
)
Expand Down
3 changes: 2 additions & 1 deletion src/data_manager/serialized_dictionary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "base/number_util.h"
#include "base/status.h"
#include "absl/base/config.h"
#include "absl/container/btree_map.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"

Expand Down Expand Up @@ -119,7 +120,7 @@ std::pair<absl::string_view, absl::string_view> SerializedDictionary::Compile(
// Build a mapping from string to its index in a serialized string array.
// Note that duplicate keys share the same index, so data is slightly
// compressed.
std::map<std::string, uint32_t> string_index;
absl::btree_map<std::string, uint32_t> string_index;
for (const auto &kv : dic) {
// This phase just collects all the strings and temporarily assigns 0 as
// index.
Expand Down

0 comments on commit 06b3da9

Please sign in to comment.