"""Plot paired allocator controls without treating missing engine telemetry as zero.""" 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-sync-c', 'RocksDB synced · C', '#2563eb'), ('rocks-sync-process', 'RocksDB synced · Safe', '#64748b'), ('zkv-c', 'zkv · C', '#bd5313'), ('zkv-process', 'zkv · Safe', '#916233')] assert len(rows) == 8 assert all(r['verified_pairs'] == '1015000' and r['failed'] == '0' and r['rate'] == '5000' and r['seconds'] == '30' for r in rows) svg = ['', '', ''] def text(x, y, value, size=16, extra=''): svg.append(f'{html.escape(value)}') def point(x, y, color): svg.append(f'') text(26, 38, 'Allocator parity in the relay index', 26) text(26, 68, '1 million initial pairs · 5k requests/sec · 10% novel · 100 pages/sec', 15) text(26, 94, '30 seconds/trial · two trials/control · reverse order · unchanged zkv', 15) text(26, 137, 'Write acknowledgement p99 (ms, logarithmic axis)', 19) left, width = 217, 365 minimum, maximum = .5, 1200 def log_x(value): return left + math.log(value / minimum) / math.log(maximum / minimum) * width for tick in [.5, 1, 10, 100, 1000]: x = log_x(tick) svg.append(f'') text(x, 326, f'{tick:g}', 13, 'text-anchor="middle"') for i, (engine, label, color) in enumerate(engines): values = sorted(int(r['ack_p99_ns']) / 1e6 for r in rows if r['engine'] == engine) assert len(values) == 2 y = 175 + i * 38 text(26, y + 5, label, 15) a, b = map(log_x, values) svg.append(f'') point(a, y, color) point(b, y, color) text(605, y + 5, f'{values[0]:.2f}–{values[1]:.2f}', 14) text(26, 378, 'zkv total adapter maintenance (seconds)', 19) for tick in [0, 5, 10, 15]: x = left + tick / 15 * width svg.append(f'') text(x, 502, str(tick), 13, 'text-anchor="middle"') for i, (engine, label, color) in enumerate(engines[2:]): values = sorted(int(r['adapter_maintenance_ns']) / 1e9 for r in rows if r['engine'] == engine) y = 419 + i * 39 text(26, y + 5, label, 15) a, b = [left + v / 15 * width for v in values] svg.append(f'') point(a, y, color) point(b, y, color) text(605, y + 5, f'{values[0]:.2f}–{values[1]:.2f}', 14) text(26, 552, 'C matches production zlay. Safe is Zig 0.17 ReleaseSafe process allocation.', 14) text(26, 580, 'RocksDB internal allocation remains C/C++; controls also select wrapper/runtime allocation.', 13) text(26, 608, 'Planned-arrival latency includes queueing. zkv flush/compaction/collection included.', 14) text(26, 636, 'RocksDB background maintenance is not exposed by the adapter timing counters.', 14) text(26, 670, 'Index-only on Fly: 2 performance CPUs, 4 GiB RAM, ext4. All writes verified after reopen.', 13) svg.append('') args.output.write_text('\n'.join(svg) + '\n')