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 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, 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.11.tar.gz (2.8 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.11-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

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

Hashes for quickbench-0.0.11.tar.gz
Algorithm Hash digest
SHA256 4839ff8d2693c2333217141182a52a6732ee29a4cb04ca22876bd4d1c744820c
MD5 7ef3dec82f657cd709051b40fb1f22ae
BLAKE2b-256 db0a8aa25416449976bdbd82f4b6409176ad44f372b3a983d0b041af86ca3ee0

See more details on using hashes here.

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

Hashes for quickbench-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 413e9dd93578486bb575f98dd1077e0bc45a2a713dca523d6fabf7c913ac06eb
MD5 bab7210546f21eb0168b61805aa505ea
BLAKE2b-256 11fd9f905fcb4e85a6b98f70443d188f6dd93522af34af43825b001b2fa04753

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