benwtrent opened a new pull request, #12789:
URL: https://github.com/apache/lucene/pull/12789

   While doing some performance testing and digging into flamegraphs, I noticed 
for smaller vectors (96dim float32), we were losing a fair bit of time within 
the `SparseFixedBitSet#getAndSet` method.
   
   I am assuming we are using `SparseFixedBitSet` for performance reasons to 
reduce memory usage?
   
   I ran some tests with topK=100 and fanOut=1000. To check memory usage, in a 
separate run, I printed out `bitSet.ramBytesUsed()` after every search.
   
   I tested using FixedBitSet instead with GLOVE and saw almost a 10% 
improvement in search speed:
   ```
   completed 1000 searches in 803 ms: 1245 QPS CPU time=801ms
   checking results
   0.695         0.80   100000  1000    16      100     1100    0       1.00    
post-filter
   ```
   
   Vs. baseline
   ```
   completed 1000 searches in 873 ms: 1145 QPS CPU time=873ms
   checking results
   0.695         0.87   100000  1000    16      100     1100    0       1.00    
post-filter
   ```
   
   The total ramBytesUsed (allocated and then gc'd collected) for 1000 searches 
over glove was `21288656` bytes. For fixed bit set, every search only allocates 
`12544`, which pans out to `12544000` bytes (actually less than sparse).
   
   To confirm this was still true for larger vectors and a larger graph, I 
tested against 400k cohere vectors (same params). There is a bit more noise in 
the measurements, so I averaged the latency over 4 runs:
   
   candidate: `6.115` with a min: `5.96`
   
   baseline: `6.23` with a min: `6.15`. 
   
   Total memory usage for sparse: `103982464` vs for total memory usage for 
Fixed `50040000`
   
   Do we know the goal for using a SparseFixedBitSet and under what conditions 
it would actually perform better than a regular FixedBitSet? I will happily 
test some more.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to