docs: search plan + counters for v1.2.0; tools/search-parity (parity + latency vs a brute-force reference)
Build and Push Docker Image / build (push) Successful in 2m50s
Build and Push Docker Image / build (push) Successful in 2m50s
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import importlib.util, json, sqlite3, sys, time
|
||||
spec = importlib.util.spec_from_file_location("parity", "/tmp/parity.py")
|
||||
sys.argv = ["parity", "/meta-core/db/meta-core.db"]
|
||||
src = open("/tmp/parity.py").read().replace("\nmain()\n", "\n")
|
||||
ns = {}
|
||||
exec(compile(src, "parity", "exec"), ns)
|
||||
db = sqlite3.connect(f"file:{DB_PATH}?mode=ro", uri=True)
|
||||
qs = ns["build_queries"](db)
|
||||
for limit in (100, 2000):
|
||||
times = []
|
||||
worst = []
|
||||
for q in qs:
|
||||
q = dict(q, limit=limit)
|
||||
try:
|
||||
_, secs = ns["post"](q)
|
||||
except Exception as e:
|
||||
print(" ERROR", e, json.dumps(q)[:150], flush=True)
|
||||
secs = 99
|
||||
times.append(secs * 1000)
|
||||
worst.append((secs * 1000, json.dumps({k: v for k, v in q.items() if k != "limit"})[:90]))
|
||||
times.sort()
|
||||
print(f"limit={limit}: n={len(times)} p50={times[len(times)//2]:.0f}ms p90={times[int(len(times)*.9)]:.0f}ms max={times[-1]:.0f}ms")
|
||||
for t, q in sorted(worst, reverse=True)[:4]:
|
||||
print(f" {t:7.0f}ms {q}")
|
||||
Reference in New Issue
Block a user