Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Lightweight profiling tool to detect performance BottleNecks in Python code.

Project Description

Hence the name: bn - BottleNeck. And you know keys B and N are very comfortable to type quickly in a row.

Usage:

bn('loop')
for item in generator:

    bn('rabbit')
    # code of rabbit

    bn('turtle')
    # code of turtle

    bn('loop')

if bn.total > 1.0:
    logging.info(bn)

Result:

TOTAL=22.2632, turtle=20.6403, rabbit=1.6209, loop=0.0020
#
# This config is default in bn>=0.1.5:
# Bn(total_key='TOTAL', format='{key}={seconds:.4f}', sep=', ')

# OR:

22.2632    TOTAL
20.6403    turtle
 1.6209    rabbit
 0.0020    loop
#
# This config is default in bn<=0.1.4:
# Bn(total_key='TOTAL', format='{seconds:>10.4f}    {key}', sep='\n')

Install:

pip install bn

Scope:

# Global "bn" is useful to profile cross-module without passing "bn" explicitly.
from bn import bn
bn.format = custom_format

# Scoped "Bn" is useful to have multiple independent profilers.
from bn import Bn
def action():
    bn = Bn(format=custom_format)

Release History

This version
History Node

0.1.5

History Node

0.1.4

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
bn-0.1.5.tar.gz
(2.1 kB) Copy SHA256 Hash SHA256
Source None May 22, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting