Skip to main content

A lightweight utility to time python functions and blocks.

Project description

QuickBench

Build Status Python Version License

A lightweight, zero-dependency Python utility for timing code execution. QuickBench provides both a decorator and a context manager which can easily measure how long functions or code blocks take to run.

QuickBench is the all-in-one performance toolkit for Python developers. Whether you are optimizing a for loop, comparing Machine Learning models, or evaluating LLM latency, QuickBench handles the metrics so you can focus on the code.

Why QuickBench?

  • Universal Timer: Benchmark functions or blocks of code with a simple decorator.
  • ML Benchmarking: Automatically compare sklearn, xgboost, etc. (Accuracy, F1, RMSE).
  • LLM Benchmarking: Measure Token/sec and Latency for GPT, Llama, or Claude wrappers.
  • pandas Output: All results return clean DataFrames ready for analysis.

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, or s.
  • Zero Dependencies: Pure Python, no heavy libraries required.

Installation

pip install QuickBench

Usage

  1. 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
  1. 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.12.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quickbench-0.0.12-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file quickbench-0.0.12.tar.gz.

File metadata

  • Download URL: quickbench-0.0.12.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for quickbench-0.0.12.tar.gz
Algorithm Hash digest
SHA256 0bd28739e142a997be22e889aa734ad15b20d698558470050c1a916e89dff951
MD5 0b4418edc993e325868b242fa7947783
BLAKE2b-256 945e01d580ba643314ab0df61ee690c9a237b0cabaf0e4608ee4c3b841dccfe8

See more details on using hashes here.

File details

Details for the file quickbench-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: quickbench-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for quickbench-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 44c43a04cf357654e80bc3312b75ef3541952c9374691a27bc84e09fbf7867c6
MD5 6a4f059cebd3029c8db505326ec408dd
BLAKE2b-256 b4dd9ca9eb1802a8656fac62a88ab5b97601107490994abab377fc319af2ffe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page