Skip to content

Commit 1d906a2

Browse files
docs: add reproducible comparisons table generated from pinned results
1 parent eaf8222 commit 1d906a2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

bench/make_results_table.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from __future__ import annotations
2+
3+
import json
4+
from pathlib import Path
5+
6+
7+
def main() -> None:
8+
p = Path("bench/results_scenario_v1.json")
9+
data = json.loads(p.read_text(encoding="utf-8"))
10+
11+
order = ["qisa", "single", "weighted_avg", "majority_binned"]
12+
13+
rows = []
14+
for k in order:
15+
r = data[k]
16+
rows.append(
17+
{
18+
"method": k,
19+
"converged": str(bool(r["converged"])),
20+
"steps": str(r["steps"]),
21+
"final_state": json.dumps(r["final_state"], ensure_ascii=False),
22+
"records": str(r["records_len"]),
23+
"trace_hash": r["trace_hash"][:16] + "…",
24+
}
25+
)
26+
27+
# Print markdown table
28+
headers = ["method", "converged", "steps", "final_state", "records", "trace_hash"]
29+
print("| " + " | ".join(headers) + " |")
30+
print("|" + "|".join(["---"] * len(headers)) + "|")
31+
for row in rows:
32+
print("| " + " | ".join(row[h] for h in headers) + " |")
33+
34+
35+
if __name__ == "__main__":
36+
main()

0 commit comments

Comments
 (0)