Skip to content

Commit

Permalink
Replace STL algorithm call with a container method (performance-ineff…
Browse files Browse the repository at this point in the history
…icient-algorithm).

PiperOrigin-RevId: 371051135
  • Loading branch information
lilao authored and tensorflow-copybara committed Apr 29, 2021
1 parent 47662c3 commit f5bc099
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tensorflow_serving/core/aspired_versions_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ void AspiredVersionsManager::ProcessAspiredVersionsRequest(
}
}
// If this version is not part of the aspired versions.
if (std::find(next_aspired_versions.begin(), next_aspired_versions.end(),
state_snapshot.id.version) == next_aspired_versions.end()) {
if (next_aspired_versions.find(state_snapshot.id.version) ==
next_aspired_versions.end()) {
VLOG(1) << "Setting is_aspired=false for " << state_snapshot.id;
basic_manager_->GetAdditionalServableState<Aspired>(state_snapshot.id)
->is_aspired = false;
Expand All @@ -297,14 +297,11 @@ void AspiredVersionsManager::ProcessAspiredVersionsRequest(
// need to be added and add them to the harness map.
for (auto& version : versions) {
bool should_add = false;
if (std::find(additions.begin(), additions.end(), version.id().version) !=
additions.end()) {
if (additions.find(version.id().version) != additions.end()) {
should_add = true;
}
if (enable_reload_servables_with_error_ &&
std::find(current_aspired_versions_with_error.begin(),
current_aspired_versions_with_error.end(),
version.id().version) !=
current_aspired_versions_with_error.find(version.id().version) !=
current_aspired_versions_with_error.end()) {
ServableId id;
id.name = std::string(servable_name);
Expand Down

0 comments on commit f5bc099

Please sign in to comment.