8000 Audit release binary size and rank measured reductions (#772) by adityamukho · Pull Request #798 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 241 additions & 0 deletions docs/audits/772/README.md

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/audits/772/cli_compare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""Compare dist thin-LTO and release full-LTO on a fixed CLI workload.

Usage: cli_compare.py DIST_EXE RELEASE_EXE OUTPUT_JSON
Includes startup, ingestion and printing; not a general query benchmark.
"""
from concurrent.futures import ThreadPoolExecutor
import json
from pathlib import Path
import subprocess
import sys
import time

base, candidate, output = sys.argv[1:]
ingest = "(transact [" + " ".join(f"[:e{i} :v {i % 20}]" for i in range(2000)) + "])\n"
query = "(query [:find (count ?e) :where [?e :v ?v]])\n"
commands = (ingest + query * 400).encode()


def run(binary, node):
start = time.perf_counter()
r = subprocess.run(["numactl", f"--cpunodebind={node}", f"--membind={node}", binary],
input=commands, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
elapsed = time.perf_counter() - start
assert not r.stderr, r.stderr
assert r.stdout.splitlines().count(b"2000") == 400
return elapsed


rows = []
with ThreadPoolExecutor(max_workers=2) as pool:
for i in range(8):
a_node, b_node = (1, 3) if i % 2 == 0 else (3, 1)
a = pool.submit(run, base, a_node)
b = pool.submit(run, candidate, b_node)
row = {"round": i, "base_node": a_node, "candidate_node": b_node,
"dist_seconds": a.result(), "release_seconds": b.result()}
rows.append(row)
Path(output).write_text(json.dumps(rows, indent=2) + "\n")
print(row, flush=True)
44 changes: 44 additions & 0 deletions docs/audits/772/compare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3
"""Run the existing envelope query probes on opposite sockets, then swap.

Usage: compare.py BASE_EXE CANDIDATE_EXE FIXTURE OUTPUT_JSON [ROUNDS] [INDICES]
INDICES is a comma-separated subset of the envelope's query-shape indices.
The fixture and adjacent .json metadata must already exist. Run only when
builds/tests have finished. This measures warm read queries, not fsync latency.
"""
from concurrent.futures import ThreadPoolExecutor
import json
from pathlib import Path
import subprocess
import sys

base, candidate, fixture, output = sys.argv[1:5]
round_count = int(sys.argv[5]) if len(sys.argv) > 5 else 4
# Representative point, scans, joins, not/or, rules, temporal, grouped/window
# and long-history reads from the pinned perf_envelope source.
indices = [0, 1, 2, 3, 5, 7, 8, 9, 10, 12, 13, 14, 19, 20, 21, 22, 23]
if len(sys.argv) > 6:
indices = [int(i) for i in sys.argv[6].split(",")]


def run(binary, node, index):
cmd = ["numactl", f"--cpunodebind={node}", f"--membind={node}",
binary, "__query", fixture, str(index), "2", "30"]
return json.loads(subprocess.check_output(cmd, text=True))


rows = []
with ThreadPoolExecutor(max_workers=2) as pool:
for round_no in range(round_count):
base_node, candidate_node = (1, 3) if round_no % 2 == 0 else (3, 1)
for index in indices:
a = pool.submit(run, base, base_node, index)
b = pool.submit(run, candidate, candidate_node, index)
a, b = a.result(), b.result()
assert not any(k in r for r in (a, b) for k in ("error", "capped_ms")), (a, b)
assert a["name"] == b["name"] and a["rows"] == b["rows"], (a, b)
row = {"round": round_no, "base_node": base_node, "candidate_node": candidate_node,
"base": a, "candidate": b}
rows.append(row)
Path(output).write_text(json.dumps(rows, indent=2) + "\n")
print(round_no, a["name"], a["p50_ms"], b["p50_ms"], flush=True)
Loading
Loading
0