Menu

Post image 1
Post image 2
1 / 2
0

Reading Algorithms Like an Engineer: What DiskANN Taught Me About Pseudocode

DEV Community·kartikay dubey·29 days ago
#SInaEtOI
#algorithms#ann#cpp#says#paper#algorithm
Reading 0:00
15s threshold

The first time I implemented Vamana from the DiskANN paper, my approximate nearest neighbor index was slower than brute force. On tiny test fixtures, brute force took 0.27 ms per query. My Vamana implementation took 22.98 ms. That sounds absurd. ANN exists to skip work. The problem was not the algorithm. It was how I mapped the paper's abstractions to actual data structures. A set is not a data structure The DiskANN pseudocode talks about sets L , V , and Nout(p) . That is fine for explanation. Code cannot store an abstract set. When the paper says L (the candidate list), I had to decide: sorted vector? heap? bounded priority queue? How do I find the closest unvisited element? How do I enforce the search-list bound? How do I remove duplicates? When the paper says V (the visited set), I had to decide: unordered_set ? dense bitset? boolean array? Node ids in my case were dense integers, so an indexed bit operation beat a hash-table lookup by a wide margin.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More