Skip to content

Commit

Permalink
fix perf test (#3255)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #3255

Reviewed By: mlomeli1

Differential Revision: D53811550

fbshipit-source-id: b103dc2d0cf43cabb9e4e7e74f4e737ff39fbbbc
  • Loading branch information
algoriddle authored and facebook-github-bot committed Feb 15, 2024
1 parent 8400ece commit c577f43
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/test_fastscan_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
TEST(TestFastScan, knnVSrange) {
// small vectors and database
int d = 64;
size_t nb = 1000;
size_t nb = 4000;

// ivf centroids
size_t nlist = 4;
Expand Down Expand Up @@ -52,16 +52,12 @@ TEST(TestFastScan, knnVSrange) {
std::vector<faiss::idx_t> labels(nb);
auto t = std::chrono::high_resolution_clock::now();
index.search(nb, database.data(), 1, distances.data(), labels.data());
auto knn_time = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - t)
.count();
auto knn_time = std::chrono::high_resolution_clock::now() - t;

faiss::RangeSearchResult rsr(nb);
t = std::chrono::high_resolution_clock::now();
index.range_search(nb, database.data(), 1.0, &rsr);
auto range_time = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::high_resolution_clock::now() - t)
.count();
auto range_time = std::chrono::high_resolution_clock::now() - t;

// we expect the perf of knn and range search
// to be similar, at least within a factor of 4
Expand Down

0 comments on commit c577f43

Please sign in to comment.