https://github.com/nicholasjng/mew
A microbenchmarking CLI for Python.
https://github.com/nicholasjng/mew
benchmark google-benchmark nanobind python
Last synced: about 1 month ago
JSON representation
A microbenchmarking CLI for Python.
- Host: GitHub
- URL: https://github.com/nicholasjng/mew
- Owner: nicholasjng
- License: apache-2.0
- Created: 2026-05-13T11:10:58.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2026-06-16T12:07:14.000Z (about 1 month ago)
- Last Synced: 2026-06-16T13:26:26.494Z (about 1 month ago)
- Topics: benchmark, google-benchmark, nanobind, python
- Language: Python
- Homepage: https://mew.readthedocs.io
- Size: 600 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# mew
[](https://mew.readthedocs.io/en/latest/)
[](https://github.com/nicholasjng/mew/actions/workflows/ci.yml)
A tool for microbenchmarking Python code, powered by [Google Benchmark](https://github.com/google/benchmark).
```python
import mew
@mew.benchmark
def bench_sorted(state: mew.State) -> None:
data = list(range(1000, 0, -1))
for _ in state:
sorted(data)
```
```console
$ mew run
mew · host=laptop cpus=10 @ 3200MHz scaling=enabled
Benchmark │ Iters │ Real │ CPU
────────────────────────────────────────────────────────────────────────────
benchmarks/bench_sort.py::bench_sorted │ 1,000,000 │ 32.10 ns │ 32.05 ns
```
- **Decorate**: `@mew.benchmark`, `@mew.parametrize`, `@mew.product` register one benchmark or a benchmark family.
- **Run**: `mew run` discovers `bench_*.py` files, streams results to a formatted table, JSON, or Parquet.
- **Profiling**: `mew run --sample` (in-process pyinstrument) and `--profile-memory` (memray allocations) in the same run; `mew profile` for native C frames via xctrace / py-spy / perf.
- **Compare**: `mew compare baseline.json head.json --fail-on-regression 5` for CI jobs.
## Installation
With a `[tool.uv.sources]` entry in your `pyproject.toml`:
```toml
[tool.uv.sources]
mew = { git = "https://github.com/nicholasjng/mew" }
```
```console
$ uv add mew # or: pip install mew
$ uv add 'mew[cpu,memory]' # opt-in profilers
```
Requires Python 3.11+. A pre-built wheel is installed where available;
otherwise the C++ extension is compiled via CMake + nanobind.
A PyPI release is planned for the future.
## Docs
- Quickstart, concepts, user guide:
- API reference:
- CLI reference:
## License
This project is licensed under the Apache-2.0 license.