Skip to content

Commit d663b4f

Browse files
authored
add config options for regression testing (#609)
* add config options for regression testing * fixed map error * make index storage directory configurable * Revert "make index storage directory configurable" This reverts commit 08779be. * move disk usage to summary and remove from table
1 parent 7e493ee commit d663b4f

3 files changed

Lines changed: 19 additions & 30 deletions

File tree

jvector-examples/src/main/java/io/github/jbellis/jvector/example/Grid.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ static void runOneGraph(OnDiskGraphIndexCache cache,
242242
// Capture post-build memory and disk state
243243
diagnostics.capturePostPhaseSnapshot("Graph Build");
244244

245+
diagnostics.printDiskStatistics("Graph Index Build");
246+
System.out.printf("Index build time: %f seconds%n", Grid.getIndexBuildTimeSeconds(ds.getName()));
247+
245248
try {
246249
for (var cpSupplier : compressionGrid) {
247250
indexes.forEach((features, index) -> {
@@ -681,10 +684,9 @@ public static List<BenchResult> runAllAndCollectResults(
681684
Path testDirectory = Files.createTempDirectory("bench");
682685
try {
683686
// Capture initial state
684-
var diagnostics = new io.github.jbellis.jvector.example.benchmarks.diagnostics.BenchmarkDiagnostics(getDiagnosticLevel());
687+
var diagnostics = new BenchmarkDiagnostics(getDiagnosticLevel());
685688
diagnostics.setMonitoredDirectory(testDirectory);
686689
diagnostics.capturePrePhaseSnapshot("Build");
687-
688690
Map<Set<FeatureId>, ImmutableGraphIndex> indexes = new HashMap<>();
689691

690692
var compressor = getCompressor(buildCompressor, ds);
@@ -732,6 +734,7 @@ public static List<BenchResult> runAllAndCollectResults(
732734

733735
// Capture post-build state
734736
diagnostics.capturePostPhaseSnapshot("Build");
737+
diagnostics.printDiskStatistics("Graph Index Build");
735738
var buildSnapshot = diagnostics.getLatestSystemSnapshot();
736739
var buildDiskSnapshot = diagnostics.getLatestDiskSnapshot();
737740

jvector-examples/src/main/java/io/github/jbellis/jvector/example/benchmarks/QueryTester.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,6 @@ public List<Metric> run(
112112
results.add(Metric.of("Max offheap usage", ".1f",
113113
systemSnapshot.memoryStats.getTotalOffHeapMemory() / (1024.0 * 1024.0)));
114114
}
115-
116-
if (diskSnapshot != null) {
117-
// Total file size in MB
118-
results.add(Metric.of("Total file size", ".1f",
119-
diskSnapshot.totalBytes / (1024.0 * 1024.0)));
120-
121-
// Number of files
122-
results.add(Metric.of("Number of files", ".0f",
123-
(double) diskSnapshot.fileCount));
124-
}
125-
126-
// Add index build time if available
127-
if (datasetName != null && Grid.getIndexBuildTimeSeconds(datasetName) != null) {
128-
results.add(Metric.of("Index build time", ".2f",
129-
Grid.getIndexBuildTimeSeconds(datasetName)));
130-
}
131115

132116
return results;
133117
}

jvector-examples/src/main/java/io/github/jbellis/jvector/example/benchmarks/diagnostics/BenchmarkDiagnostics.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ public void logSummary() {
259259
System.out.println("\n=== BENCHMARK DIAGNOSTICS SUMMARY ===");
260260
System.out.printf("Diagnostic Level: %s%n", level);
261261
System.out.printf("System Snapshots: %d%n", snapshots.size());
262-
System.out.printf("Disk Snapshots: %d%n", diskSnapshots.size());
263262
System.out.printf("Timing Analyses: %d%n", timingAnalyses.size());
264263

265264
if (!snapshots.isEmpty()) {
@@ -285,28 +284,31 @@ public void logSummary() {
285284
DiskUsageMonitor.formatBytes(last.memoryStats.mappedBufferMemory));
286285
}
287286

287+
// Performance variance analysis
288+
if (timingAnalyses.size() > 1) {
289+
System.out.println("\nPerformance Variance Analysis:");
290+
for (int i = 1; i < timingAnalyses.size(); i++) {
291+
comparePhases(timingAnalyses.get(0).phase, timingAnalyses.get(i).phase);
292+
}
293+
}
294+
295+
System.out.println("=====================================\n");
296+
}
297+
298+
public void printDiskStatistics(String label) {
288299
// Disk usage summary
289300
if (!diskSnapshots.isEmpty()) {
290301
DiskUsageMonitor.DiskUsageSnapshot firstDisk = diskSnapshots.get(0);
291302
DiskUsageMonitor.DiskUsageSnapshot lastDisk = diskSnapshots.get(diskSnapshots.size() - 1);
292303
DiskUsageMonitor.DiskUsageSnapshot totalDisk = lastDisk.subtract(firstDisk);
293304

294-
System.out.printf("\nDisk Usage Summary:%n");
305+
System.out.printf("\nDisk Usage Summary %s:%n", label);
295306
System.out.printf(" Total Disk Used: %s%n", DiskUsageMonitor.formatBytes(lastDisk.totalBytes));
296307
System.out.printf(" Total Files: %d%n", lastDisk.fileCount);
297308
System.out.printf(" Net Change: %s, %+d files%n",
298-
DiskUsageMonitor.formatBytes(totalDisk.totalBytes), totalDisk.fileCount);
299-
}
300-
301-
// Performance variance analysis
302-
if (timingAnalyses.size() > 1) {
303-
System.out.println("\nPerformance Variance Analysis:");
304-
for (int i = 1; i < timingAnalyses.size(); i++) {
305-
comparePhases(timingAnalyses.get(0).phase, timingAnalyses.get(i).phase);
306-
}
309+
DiskUsageMonitor.formatBytes(totalDisk.totalBytes), totalDisk.fileCount);
307310
}
308311

309-
System.out.println("=====================================\n");
310312
}
311313

312314
/**

0 commit comments

Comments
 (0)