Speedup IndexRowwiseMinMax::sa_decode() (#2536)

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

Allocated temporary buffers are of the correct sizes.

Reviewed By: mdouze

Differential Revision: D40439826

fbshipit-source-id: 97087953ce9c1c98b4ab38cab2223c7191ea7025
pull/1838/head^2
Alexandr Guzhva 2022-10-17 15:22:46 -07:00 committed by Facebook GitHub Bot
parent 8ff1bc259d
commit ce94df4ea8
1 changed files with 4 additions and 2 deletions

View File

@ -154,8 +154,10 @@ void sa_decode_impl(
const size_t new_code_size = index->sa_code_size();
// allocate tmp buffers
std::vector<uint8_t> tmp(chunk_size * old_code_size);
std::vector<StorageMinMaxFP16> minmax(chunk_size);
std::vector<uint8_t> tmp(
(chunk_size < n_input ? chunk_size : n_input) * old_code_size);
std::vector<StorageMinMaxFP16> minmax(
(chunk_size < n_input ? chunk_size : n_input));
// all the elements to process
size_t n_left = n_input;