# coveragepy Status

Last updated: 2026-04-10

## Current state

Scouting complete. Optimization targets identified, no PRs opened yet.

## Target repo

`~/Desktop/work/coveragepy_org/coveragepy`

## PRs

None yet.

## Key findings

- **Hot path**: PyTracer._trace() called on every line/call/return event — dictionary lookups, set.add() on every hit
- **Data persistence**: numbits encoding uses zip_longest generators, add_lines/add_arcs do per-file SQL round-trips
- **Quick wins**: numbits_union() optimization (low complexity), sys.path hash caching in should_trace(), SQL batching in add_lines/add_arcs
- **Parser**: PythonParser does multi-pass source text analysis with repeated text.count("\n") calls

## VM

Not provisioned. coverage.py is pure Python + C extension — local benchmarking sufficient. Use existing test suite + `hyperfine` for end-to-end, `pytest-benchmark` for targeted functions.

## Next steps

1. Start with numbits optimizations (lowest risk, clear speedup path)
2. Batch SQL operations in add_lines/add_arcs
3. Benchmark with coverage's own test suite as workload

## Blockers

None.
