Skip to content

Commit

Permalink
Simplify non-optimal points removal.
Browse files Browse the repository at this point in the history
Summary:
This version is more concise and doesn't need a new scope to reduce visibility of local variable `i`.

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: mdouze

Differential Revision: D46431189

fbshipit-source-id: 5bbe8df6014d8e25aeb8d5d15145b703e9651327
  • Loading branch information
ttsugriy authored and facebook-github-bot committed Jun 8, 2023
1 parent f82298f commit 8ec166c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions faiss/AutoTune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,10 @@ bool OperatingPoints::add(
return false;
}
}
{ // remove non-optimal points from array
int i = a.size() - 1;
while (i > 0) {
if (a[i].t < a[i - 1].t)
a.erase(a.begin() + (i - 1));
i--;
// remove non-optimal points from array
for (int i = a.size() - 1; i > 0; --i) {
if (a[i].t < a[i - 1].t) {
a.erase(a.begin() + (i - 1));
}
}
return true;
Expand Down

0 comments on commit 8ec166c

Please sign in to comment.