kaivalnp commented on PR #15341:
URL: https://github.com/apache/lucene/pull/15341#issuecomment-3519965876

   Sorry for the delay here, I ran benchmarks a few more times offline, and the 
differences in `index(s)` and `force_merge(s)` seem to be noisy (they take 
about the same time in `main` v/s this PR on average)
   
   This is because:
   1. During indexing, the HNSW graph is [built 
on-heap](https://github.com/apache/lucene/blob/2bae327c087234bbdb76006c036a949dcdf3239f/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99HnswVectorsWriter.java#L471)
 -- so there's no impact of alignment
   2. During merging, we [create a new temp 
file](https://github.com/apache/lucene/blob/d0860362c2b687cadd5cae0fa3de3e371261f898/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsWriter.java#L256-L258)
 to write vectors merged from all segments -- which is then used to [score 
vectors](https://github.com/apache/lucene/blob/d0860362c2b687cadd5cae0fa3de3e371261f898/lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsWriter.java#L315-L321)
 during graph creation in the new segment -- and it starts at offset 0 (i.e. 
already aligned)
   
   The only constant is the speedup in search time (3-4%)
   
   ---
   
   Another recent run with 1M Cohere vectors, 768d, `DOT_PRODUCT`, force merged 
into a single segment:
   
   `main`:
   
   ```
   recall  latency(ms)  netCPU  avgCpuCount     nDoc  topK  fanout  maxConn  
beamWidth  quantized  visited  index(s)  index_docs/s  force_merge(s)  
num_segments  index_size(MB)  vec_disk(MB)  vec_RAM(MB)  indexType
    0.892        1.880   1.872        0.996  1000000   100      50       32     
   250         no     5419    161.46       6193.68          197.68             
1         3012.18      2929.688     2929.688       HNSW
   ```
   
   This PR:
   
   ```
   recall  latency(ms)  netCPU  avgCpuCount     nDoc  topK  fanout  maxConn  
beamWidth  quantized  visited  index(s)  index_docs/s  force_merge(s)  
num_segments  index_size(MB)  vec_disk(MB)  vec_RAM(MB)  indexType
    0.891        1.824   1.815        0.995  1000000   100      50       32     
   250         no     5408    162.23       6163.94          197.08             
1         3012.26      2929.688     2929.688       HNSW
   ```


-- 
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