https://github.com/orsinium-labs/true-north
🧠Powerful and Pythonic framework for reproducible benchmarks of Python code.
https://github.com/orsinium-labs/true-north
benchmark benchmarks malloc malloc-benchmarks opcodes performance python python3 pythonic tracing
Last synced: about 2 months ago
JSON representation
🧠Powerful and Pythonic framework for reproducible benchmarks of Python code.
- Host: GitHub
- URL: https://github.com/orsinium-labs/true-north
- Owner: orsinium-labs
- License: mit
- Created: 2022-10-05T11:34:03.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-25T14:09:12.000Z (over 2 years ago)
- Last Synced: 2025-06-28T17:09:11.637Z (4 months ago)
- Topics: benchmark, benchmarks, malloc, malloc-benchmarks, opcodes, performance, python, python3, pythonic, tracing
- Language: Python
- Homepage: https://true-north.orsinium.dev/
- Size: 421 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# true-north
Beautiful, powerful, and pythonic benchmarks engine for Python code.
Features:
+ Follows best practices of benchmarking to produce the most reliable results.
+ Detects caching and side-effects.
+ Traces memory usage and allocations (opt-in).
+ Opcodes tracing for reproducble benchmarks (opt-in).
+ 100% type safe.
+ Zero dependency.
+ Highly configurable.
+ Nice and colorful output.
+ Ships with CLI to discover and run all benchmarks.
+ A friendly API to write your own logic on top of benchmarks.```text
sorting algorithms
list.sort
possible side-effect detected: slowest iteration x21 slower than fastest
5k loops, best of 5: 43.579 us ± 12.681 us ████▇
11 ops, 3961 ns/op
sorted
5k loops, best of 5: 43.911 us ± 3.697 us x1.01 slower █████
11 ops, 3991 ns/op
insert_sort
2 loops, best of 5: 100.662 ms ± 111.725 us x2309.85 slower █████
11_683_767 ops, 8 ns/op
```## Installation
```bash
python3 -m pip install true-north
```## Usage
```python
import true_northgroup = true_north.Group()
@group.add
def math_sorted(r):
val = [1, 2, 3] * 300
# timer start before entering the loop
# and stops when leaving it
for _ in r:
sorted(val)# run and print all benchmarks in the group
if __name__ == '__main__':
group.print()
```See [examples](./examples/) for more examples and [true-north.orsinium.dev](https://true-north.orsinium.dev/) for chad documentation.