Skip to content

Commit f00f396

Browse files
committed
addressing code review comments
1 parent 425734a commit f00f396

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

benchmarks-jmh/src/main/java/io/github/jbellis/jvector/bench/ParallelWriteBenchmark.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
/**
5353
* JMH benchmark that mirrors the ParallelWriteExample: it builds a graph from vectors, then
54-
* writes the graph to disk sequentially and in parallel using NVQ + FUSED_ADC features,
54+
* writes the graph to disk sequentially and in parallel using NVQ + FUSED_PQ features,
5555
* and verifies that the outputs are identical.
5656
*/
5757
@BenchmarkMode(Mode.AverageTime)
@@ -70,12 +70,15 @@ public class ParallelWriteBenchmark {
7070
@Param({"1024"})
7171
int dimension;
7272

73+
@Param({"true", "false"})
74+
boolean addHierarchy;
75+
7376
// Graph build parameters
7477
final int M = 32;
7578
final int efConstruction = 100;
7679
final float neighborOverflow = 1.2f;
7780
final float alpha = 1.2f;
78-
final boolean addHierarchy = false;
81+
//final boolean addHierarchy = false;
7982
final boolean refineFinalGraph = true;
8083

8184
// Dataset and index state

jvector-base/src/main/java/io/github/jbellis/jvector/graph/disk/OnDiskGraphIndexWriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.github.jbellis.jvector.graph.disk;
1818

19+
import io.github.jbellis.jvector.annotations.Experimental;
1920
import io.github.jbellis.jvector.disk.BufferedRandomAccessWriter;
2021
import io.github.jbellis.jvector.disk.RandomAccessWriter;
2122
import io.github.jbellis.jvector.graph.ImmutableGraphIndex;
@@ -241,6 +242,7 @@ public synchronized void write(Map<FeatureId, IntFunction<Feature.State>> featur
241242
* @param featureStateSuppliers suppliers for feature state data
242243
* @throws IOException if an I/O error occurs
243244
*/
245+
@Experimental
244246
private void writeL0RecordsParallel(Map<FeatureId, IntFunction<Feature.State>> featureStateSuppliers) throws IOException {
245247
if (filePath == null) {
246248
throw new IllegalStateException("Parallel writes require a file path. Use Builder(ImmutableGraphIndex, Path) constructor.");
@@ -362,7 +364,7 @@ public synchronized void writeHeader(ImmutableGraphIndex.View view) throws IOExc
362364
* to ensure that all parallel write operations have fully completed before writing the footer (e.g., checksum).
363365
* The footer must only be written after all data has been flushed and no further writes are in progress,
364366
* to avoid data corruption or incomplete checksums. This class does not currently coordinate or synchronize
365-
* footer writing with parallel operations. Parallel writes are experimental and should be used with caution.
367+
* footer writing with parallel operations.
366368
*/
367369
public synchronized long checksum() throws IOException {
368370
long endOffset = out.position();
@@ -373,8 +375,6 @@ public synchronized long checksum() throws IOException {
373375
* Enables parallel writes for L0 records. This can significantly improve throughput
374376
* for large graphs by parallelizing record building across multiple cores.
375377
* <p>
376-
* Note: This is currently experimental. The sequential path is the default.
377-
*
378378
* @param enabled whether to enable parallel writes
379379
*/
380380
public void setParallelWrites(boolean enabled) {

jvector-examples/src/main/java/io/github/jbellis/jvector/graph/disk/ParallelWriteExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ public static void main(String[] args) throws IOException {
322322
int efConstruction = 100;
323323
float neighborOverflow = 1.2f;
324324
float alpha = 1.2f;
325-
boolean addHierarchy = false;
325+
boolean addHierarchy = true;
326326
boolean refineFinalGraph = true;
327327

328328
System.out.printf("Building graph with PQ-compressed vectors (M=%d, efConstruction=%d)...%n", M, efConstruction);

jvector-examples/yaml-configs/autoDefault.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 5
1+
version: 6
22

33
dataset: cohere-english-v3-100k
44

0 commit comments

Comments
 (0)