Skip to content

Commit

Permalink
Update benchmarking library code to work for IdMap index as well (#4093)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #4093

Update benchmarking library code to work for IdMap index as well by calling add_with_ids instead of add since ids are required for IDMap index

Reviewed By: gtwang01

Differential Revision: D67254267

fbshipit-source-id: 947a141edbdd7e44d33a297054869e3b932e3b89
  • Loading branch information
satymish authored and facebook-github-bot committed Dec 16, 2024
1 parent 66c989a commit db3409a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions benchs/bench_fw/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,13 @@ def fetch_index(self):
lambda: add_preassigned(index_ivf, xbt, QI.ravel()),
once=True,
)
elif isinstance(index, faiss.IndexIDMap):
_, t, _ = timer(
"add_with_ids",
lambda: index.add_with_ids(
xb, np.arange(len(xb), dtype='int32')),
once=True,
)
else:
_, t, _ = timer(
"add",
Expand Down

0 comments on commit db3409a

Please sign in to comment.