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.11.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.11.tar.gz.
File metadata
- Download URL: quickbench-0.0.11.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 |
4839ff8d2693c2333217141182a52a6732ee29a4cb04ca22876bd4d1c744820c
|
|
| MD5 |
7ef3dec82f657cd709051b40fb1f22ae
|
|
| BLAKE2b-256 |
db0a8aa25416449976bdbd82f4b6409176ad44f372b3a983d0b041af86ca3ee0
|
File details
Details for the file quickbench-0.0.11-py3-none-any.whl.
File metadata
- Download URL: quickbench-0.0.11-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 |
413e9dd93578486bb575f98dd1077e0bc45a2a713dca523d6fabf7c913ac06eb
|
|
| MD5 |
bab7210546f21eb0168b61805aa505ea
|
|
| BLAKE2b-256 |
11fd9f905fcb4e85a6b98f70443d188f6dd93522af34af43825b001b2fa04753
|