Zero-dependency performance measurement decorators for Python
Project description
speedopy
Zero-dependency performance measurement decorators for Python.
Just import a decorator, slap it on your function, and instantly see metrics printed to the console. No config, no setup, no external packages.
Install
pip install speedopy
Decorators
| Decorator | What It Measures |
|---|---|
cpu_time |
CPU processing time (excludes I/O) |
real_time |
Wall-clock time |
memory_usage |
Peak memory allocated (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 |
I/O wait time (real - cpu) |
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:
[io_time] process_data -> real: 0.182345s, cpu: 0.171875s, io_wait: 0.010470s
[memory_usage] process_data -> current: 472 B, peak: 8.06 MB
[cpu_time] process_data -> 0.183291s
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() # [call_count] my_func -> called 1 time(s)
my_func() # [call_count] my_func -> called 2 time(s)
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
speedopy-0.1.0.tar.gz
(4.6 kB
view details)
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.1.0.tar.gz.
File metadata
- Download URL: speedopy-0.1.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db9193d65518ec6b318c51da610394f08d159e1d031e618d676582302c2d39f3
|
|
| MD5 |
2c0339053c11e02dbbd089397805bdd7
|
|
| BLAKE2b-256 |
ce6ea77c3fd1763fa75fc0dbe263eb6977c2fb3a93470fafb1f125f46766811e
|
File details
Details for the file speedopy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: speedopy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 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 |
2a84b4f3a665e90c309b9f072ebb3355471d16395e33ff0a585cd31744f49c09
|
|
| MD5 |
8d2a783c49a09ca5c01390d6d1dafa4a
|
|
| BLAKE2b-256 |
77942c8280fa1e629d3e6ddc81a17c19de5175d5d045f9f2e3b852cb6279a596
|