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.2.0.tar.gz
(8.0 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.2.0.tar.gz.
File metadata
- Download URL: speedopy-0.2.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca0b96caa51443ebd858b525e92976e38d18d1c6234ebc35b5c2d1f2fec825c
|
|
| MD5 |
2b4d7abd8d0c8a5694eb58323ba26939
|
|
| BLAKE2b-256 |
0a26aa7a50060bceef79f632f55c4e54970eb49f8118c5df6127ee02c556ab02
|
File details
Details for the file speedopy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: speedopy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.3 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 |
4803ba8ae6c62ab05b95bc3cda6b6796f8c7d6427c12aa71b356f13d0eea23c8
|
|
| MD5 |
d9e7cc04bdcee04d179332f6824326f6
|
|
| BLAKE2b-256 |
90bf026a431ad17863cafa352a5e09eefc55bcb9d7c4f3609d8bde71a0167305
|