rust-cv / hwt

Hamming Weight Tree from the paper "Online Nearest Neighbor Search in Hamming Space"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert search module to use a hand-optimized iterator for each level of the tree

vadixidav opened this issue · comments

Currently the search module is implemented in a convenient, but inefficient, way. It defines an iterator for 2 bit slices, then another one for 4 bit slices that flat maps two 2 bit slice ones, and so on. This causes the type name length (Rust compiler/type issue) to grow out of control and then requires Box to be used to wrap the types. In addition to the type name length issue, it is also very wasteful because of how it uses up to 128 128-bit operations on 1-bit numbers. The search module should be refactored (possibly at the expense of code size) to accommodate speed. SIMD should be used where possible.