Benchmark fleet packages, detect regressions, profile edge hardware. Pure Python.
- Timer benchmarks — high-resolution timing with statistical analysis (mean, median, p95, p99, std dev)
- Memory profiling — track memory allocation during benchmark runs
- Benchmark suites — group and run benchmarks together with setup/teardown lifecycle
- Regression detection — compare runs against baselines, flag regressions automatically
- Edge profiler — profile performance on edge/constrained hardware targets
- Comparison reports — side-by-side results in markdown, JSON, or terminal tables
pip install cocapn-benchmarkfrom cocapn_benchmark import Benchmark, BenchmarkSuite, BenchmarkReport
# Benchmark a function
bench = Benchmark("json_parse", lambda: __import__("json").loads('{"key": "value"}'))
bench.run()
print(bench.result) # BenchmarkResult with timing stats
# Build a suite
suite = BenchmarkSuite("fleet-core")
suite.add(Benchmark("tile_create", lambda: Tile("Q", "A")))
suite.add(Benchmark("room_query", lambda: room.ask("test")))
results = suite.run_all()
# Generate a report
report = BenchmarkReport(suite_results=results)
print(report.to_markdown())
# Regression check
from cocapn_benchmark import RegressionConfig
config = RegressionConfig(max_slowdown_pct=10.0)
regressions = report.check_regressions(baseline, config)Runs fn through setup → warmup → measurement → teardown.
- OpenConstruct Documentation — ecosystem-wide docs and guides
Performance backbone for the SuperInstance fleet. Every package runs through cocapn-benchmark before release.
- cocapn — Core agent infrastructure
- cocapn-health-rs — Fleet health (Rust)
- cocapn-cli — Terminal output formatting
pip install pytest
pytest tests/pip install cocapn-benchmarkPython 3.10+. MIT license.