Commit Graph

2 Commits (1d0e8d489f15f7e34f5ebba978d44e675e2e35dd)

Author SHA1 Message Date
Chengqi Deng 6f6e90162b Fix typo in bench_index_flat (#1810)
Summary:
This PR fixed the typo in `bench_index_flat.py`.

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1810

Reviewed By: beauby

Differential Revision: D27706115

Pulled By: mdouze

fbshipit-source-id: 35515450be8eb45d6a2e98c7372333d98fc0f7b4
2021-04-15 22:58:42 -07:00
Matthijs Douze e1adde0d84 Faster brute force search (#1502)
Summary:
This diff streamlines the code that collects results for brute force distance computations for the L2 / IP and range search / knn search combinations.

It introduces a `ResultHandler` template class that abstracts what happens with the computed distances and ids. In addition to the heap result handler and the range search result handler, it introduces a reservoir result handler that improves the search speed for  large k (>=100).

Benchmark results (https://fb.quip.com/y0g1ACLEqJXx#OCaACA2Gm45) show that on small datasets (10k) search is 10-50% faster (improvements are larger for small k). There is room for improvement in the reservoir implementation, whose implementation is quite naive currently, but the diff is already useful in its current form.

Experiments on precomputed db vector norms for L2 distance computations were not very concluding performance-wise, so the implementation is removed from IndexFlatL2.

This diff also removes IndexL2BaseShift, which was never used.

Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1502

Test Plan:
```
buck test //faiss/tests/:test_product_quantizer
buck test //faiss/tests/:test_index -- TestIndexFlat
```

Reviewed By: wickedfoo

Differential Revision: D24705464

Pulled By: mdouze

fbshipit-source-id: 270e10b19f3c89ed7b607ec30549aca0ac5027fe
2020-11-04 22:16:23 -08:00