Zero-dependency performance measurement decorators for Python
Project description
โก speedopy
Zero-dependency performance measurement decorators + CLI profiler for Python.
Just import a decorator, slap it on your function, and instantly see beautiful, organized metrics in the terminal. No config, no setup, no external packages.
Install
pip install speedopy
๐ CLI Runner โ Profile Any Script Instantly
Run any Python script and get a full performance report โ no decorators needed:
python -m speedopy your_script.py
This collects all 9 metrics at once and prints a single organized, color-coded report:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โก SPEEDOPY โ Performance Report
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโ โฑ TIMING โโโโโโโโโโโโโโโโโโโโโโโโ
โ Real (wall-clock) time 69.15 ms โ
โ CPU time 62.50 ms โ
โ Thread time 62.50 ms โ
โ I/O wait (estimated) 6.65 ms โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโ ๐ง MEMORY โโโโโโโโโโโโโโโโโโโโโโโ
โ Current memory 87.96 KB โ
โ Peak memory 274.82 KB โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ โป GC & OBJECTS โโโโโโโโโโโโโโโโโโโ
โ GC objects collected 11 โ
โ GC runs during execution 2 โ
โ Net new objects +81 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ Decorators
Each decorator shows its own neat box in the terminal:
| Decorator | What It Measures |
|---|---|
cpu_time |
CPU processing time (excludes I/O) |
real_time |
Wall-clock time |
memory_usage |
Current + peak memory (auto-formats B/KB/MB) |
thread_time |
CPU time for the current thread only |
call_count |
Number of times a function has been called |
function_profile |
Full cProfile report (top 10 calls) |
io_time |
Real time, CPU time, and I/O wait |
gc_stats |
Garbage collections triggered |
object_count |
Net new Python objects created |
Usage
from speedopy import cpu_time, memory_usage, io_time
@cpu_time
@memory_usage
@io_time
def process_data():
data = [i ** 2 for i in range(1_000_000)]
return sum(data)
process_data()
Output:
โโโโโโโโโโโโ ๐พ I/O TIME โบ process_data โโโโโโโโโโโโ
โ Real time 182.35 ms โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ CPU time 171.88 ms โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ I/O wait 10.47 ms โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโ ๐ง MEMORY โบ process_data โโโโโโโโโโโโโ
โ Current 472 B โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Peak 8.06 MB โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโ โฑ CPU TIME โบ process_data โโโโโโโโโโโโโโ
โ CPU time 183.29 ms โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Stack Multiple Decorators
from speedopy import cpu_time, memory_usage, call_count
@call_count
@cpu_time
@memory_usage
def my_func():
return sum(range(500_000))
my_func()
my_func()
Requirements
- Python 3.8+
- No external dependencies
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speedopy-0.3.0.tar.gz.
File metadata
- Download URL: speedopy-0.3.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a8cf06a1141856cffe25d99928666ef1dc0af45da7dc978bf2bb128d30dbb08
|
|
| MD5 |
b939a90f05ed4859adbf90c47978e601
|
|
| BLAKE2b-256 |
dea1f0fd666245e550bdd93c82cc35d448725e83d3043ddb5fd59627c093070b
|
File details
Details for the file speedopy-0.3.0-py3-none-any.whl.
File metadata
- Download URL: speedopy-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cda1cd7c8e8f5e9439d432fd3dd49756a5fcd72366eee502bd769bc4577ef06
|
|
| MD5 |
f43a04a67f2f46edaf321af644ff6dae
|
|
| BLAKE2b-256 |
071a73dcbb46934298296ddbf6a5bd459342de23583818df2633fe85a7cb6e26
|