1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Plot a short same-input codec screen; read_case verifies the raw oracle results."""
from pathlib import Path
import sys
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from replay_report import read_case
root = Path(sys.argv[1])
variants = ['grouped', 'legacy', 'rocks']
rows = [read_case(root / name) for name in variants]
assert len({r['corpus_sha256'] for r in rows}) == 1
assert len({(r['frames'], r['offered_rate']) for r in rows}) == 1
labels = ['Grouped ZKV', 'Legacy ZKV', 'Durable RocksDB']
colors = ['#18765a', '#52677d', '#bf663e']
plt.rcParams.update({'font.size': 11, 'svg.fonttype': 'none',
'axes.spines.top': False, 'axes.spines.right': False})
fig, axes = plt.subplots(3, 1, figsize=(7, 10), layout='constrained')
bars = axes[0].bar(labels, [r['completion_seconds'] for r in rows], color=colors)
axes[0].bar_label(bars, fmt='%.3f', padding=4)
target = rows[0]['frames'] / rows[0]['offered_rate']
axes[0].axhline(target, color='#9e3a32', linestyle='--', label=f'Offer schedule: {target:.2f} s')
axes[0].set(title='Completion through final event-file write', ylabel='Seconds', ylim=(0, 17))
axes[0].legend(frameon=False, loc='upper left')
bottom = [0] * 3
for component, color, label in [('relay', '#247d80', 'Relay'), ('db', '#8c5cb3', 'PostgreSQL')]:
values = [r['resources'][component]['cpu_s'] for r in rows]
axes[1].bar(labels, values, bottom=bottom, color=color, label=label)
bottom = [a + b for a, b in zip(bottom, values)]
axes[1].set(title='CPU across ingestion and oracle readback', ylabel='CPU seconds')
axes[1].legend(frameon=False)
bars = axes[2].bar(labels, [r['resources']['relay']['peak_mib'] for r in rows], color=colors)
axes[2].bar_label(bars, fmt='%.1f', padding=4)
axes[2].set(title='Relay cgroup memory peak', ylabel='MiB, including charged cache', ylim=(0, 140))
for ax in axes:
ax.grid(axis='y', alpha=.15)
ax.set_axisbelow(True)
fig.suptitle('Same 8,016 signed frames offered at 600/s\nSingle trials; short screens, not sustained-capacity proof', fontsize=13)
fig.savefig(root / 'comparison.svg', facecolor='white')
fig.savefig(root / 'comparison.png', facecolor='white', dpi=140)
svg = root / 'comparison.svg'
svg.write_text('\n'.join(line.rstrip() for line in svg.read_text().splitlines()) + '\n')