Avoid memory allocation on base::Feature lookup
FeatureList::IsFeatureEnabled and FeatureList::GetAssociatedFieldTrial call std::map<std::string, _>::find() with a const char* argument. By default, this results in a conversion to an std::string, hence incurring a memory allocation. C++14 adds a new std::map::find() override to support map lookups by types other than the key when a transparent comparator is specified. This allows, for example, performing lookups in an std::map<std::string, _> using a const char*. This CL changes the declartion of FeatureList::overrides_ to support these allocation-free lookups. Bug: 960618 Change-Id: I59c8d2c16e86a3a6ca458b4047c445b1373df05d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1600083 Commit-Queue: Collin Baker <collinbaker@chromium.org> Reviewed-by:Albert J. Wong <ajwong@chromium.org> Cr-Commit-Position: refs/heads/master@{#657544}
Showing
Please register or sign in to comment