chore: add benchmark analysis scripts

This commit is contained in:
2026-03-18 18:12:33 +00:00
parent e9ef5ebbcd
commit 5704942950
5 changed files with 195 additions and 1900 deletions
+47
View File
@@ -0,0 +1,47 @@
import csv
def check_lengths(filename, label):
lengths = []
failed = 0
total = 0
with open(filename, 'r') as f:
reader = csv.reader(f)
next(reader)
for row in reader:
if not row or row[0].startswith('#'):
continue
total += 1
try:
length = int(row[2])
lengths.append(length)
if length == 0:
failed += 1
except:
pass
print(f"\n=== {label} ===")
print(f"Total paths: {total}")
print(f"Failed paths (length=0): {failed} ({100*failed/total if total else 0:.1f}%)")
print(f"Paths with length > 0: {total - failed}")
if lengths:
avg = sum(lengths) / len(lengths)
print(f"Avg length (all): {avg:.1f}")
nonzero = [l for l in lengths if l > 0]
if nonzero:
print(f"Avg length (non-zero): {sum(nonzero)/len(nonzero):.1f}")
print(f"Max length: {max(lengths)}")
# Length buckets
print("\nLength distribution:")
buckets = [(0, 0), (1, 5), (6, 10), (11, 50), (51, 100), (100, 1000)]
for lo, hi in buckets:
if lo == hi == 0:
count = sum(1 for l in lengths if l == 0)
else:
count = sum(1 for l in lengths if lo <= l <= hi)
pct = 100*count/len(lengths) if lengths else 0
print(f" {lo}-{hi if hi < 1000 else 'inf'} nodes: {count} ({pct:.1f}%)")
check_lengths("/home/popertots/bench/pathfinding_benchmark_baseline_release.csv", "BASELINE")
check_lengths("pathfinding_benchmark_current.csv", "CURRENT")