A lightweight utility to time python functions and blocks.
Project description
QuickBench
A lightweight, zero-dependency Python utility for timing code execution. QuickBench provides both a decorator and a context manager to easily measure how long functions or code blocks take to run.
Features
- Decorator Support: Time entire functions with a single line (
@monitor). - Context Manager: Time specific blocks of code inside a function (
with monitor():). - Human Readable: Automatically formats output to
ns,µs,ms, ors. - Zero Dependencies: Pure Python, no heavy libraries required.
Installation
pip install quickbench
Usage
- As a Decorator Use @monitor to time a specific function.
from QuickBench import monitor
import time
@monitor
def heavy_computation():
# Simulating work
time.sleep(1.5)
return "Done"
heavy_computation()
# Output: [heavy_computation] finished in 1.50 s
- As a Context Manager Use with monitor(): to time a specific chunk of logic.
from QuickBench import monitor
import time
def process_data():
print("Preparing data...")
with monitor(label="Database Query"):
# Only time this specific part
time.sleep(0.25)
print("Finished.")
process_data()
# Output: [Database Query] finished in 250.00 ms
Author: Ankit Dutta
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quickbench-0.0.1.tar.gz
(2.8 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 quickbench-0.0.1.tar.gz.
File metadata
- Download URL: quickbench-0.0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e494e2e5bff2589ad10f93eca35b140cc061152e1cbb925c2ebb91cfe092b477
|
|
| MD5 |
dac042b894addc4ef6b79447ad12c07f
|
|
| BLAKE2b-256 |
59d2fd8c361e575d30aba3c0404d906e4600a6062e40f3947e3da2600c443b72
|
File details
Details for the file quickbench-0.0.1-py3-none-any.whl.
File metadata
- Download URL: quickbench-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
801e7c84d2d693186ef66783176d7b9ae93b82c9a2ffc91f8ed06788dbf7ed54
|
|
| MD5 |
c9d7d0360dbd69028f71c9ba41249091
|
|
| BLAKE2b-256 |
20ea44a525c5fb4c9aed83df439f4bcd4afdb07451df31e687dba37af73054c2
|