"""Render a bounded three-engine calibration from its exported observations.""" import argparse import csv import html import math from pathlib import Path parser = argparse.ArgumentParser() parser.add_argument('source', type=Path) parser.add_argument('output', type=Path) args = parser.parse_args() rows = list(csv.DictReader(args.source.open())) engines = [('rocks-default', 'RocksDB default', '#2563eb'), ('rocks-sync', 'RocksDB synced', '#64748b'), ('zkv-pilot', 'zkv pilot', '#bd5313')] selected = [] for engine, label, color in engines: matches = [row for row in rows if row['engine'] == engine] assert len(matches) == 1 selected.append((matches[0], label, color)) assert all(row['rate'] == '1000' and row['seconds'] == '5' and row['novel_percent'] == '10' and row['read_rate'] == '100' and row['seed_count'] == '65536' for row, _, _ in selected) maximum = math.ceil(max(int(row[key]) / 1e6 for row, _, _ in selected for key in ['ack_p99_ns', 'scan_p99_ns']) * 1.15 * 2) / 2 svg = ['', '', ''] def text(x, y, value, size=17, extra=''): svg.append(f'{html.escape(value)}') text(30, 40, 'Pilot calibration on Fly', 27) text(30, 72, '1k membership requests/sec · 10% novel · 65,536 initial pairs') text(30, 99, '5 seconds/engine · 100 scans/sec · 100 DIDs per page · varied cursors', 16) for panel, (title, key) in enumerate([ ('Write acknowledgement p99 (ms)', 'ack_p99_ns'), ('Page scan p99 (ms)', 'scan_p99_ns'), ]): top = 145 + panel * 205 text(30, top, title, 19) left, width = 200, 430 for i in range(int(maximum * 2) + 1): tick = i / 2 x = left + tick / maximum * width svg.append(f'') text(x, top + 160, f'{tick:g}', 13, 'text-anchor="middle"') for i, (row, label, color) in enumerate(selected): y = top + 25 + i * 39 value = int(row[key]) / 1e6 svg.append(f'') text(30, y + 18, label, 16) text(655, y + 18, f'{value:.3f}', 16) text(30, 576, 'zkv: independent reader; native owner; up to 16 requests; 1 ms aggregation.', 15) text(30, 599, 'RocksDB: per-request writes from 16 native workers; WAL enabled in both modes.', 15) text(30, 622, 'Latency includes queueing from planned arrival. Index-only; not relay capacity.', 15) svg.append('') args.output.write_text('\n'.join(svg) + '\n')