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('iteration')
for item in generator:
bn('step 1')
# code of step 1
bn('step 2')
# code of step 2
bn('iteration')
bn() # Stop tracking.
if bn.total > 1.0:
logging.info(bn)
Result:
22.2632 TOTAL 20.6403 step 2 1.6209 step 1 0.0020 iteration
Scope:
pip install bn
from bn import bn
# OR:
from bn import Bn
def action():
bn = Bn()
Config:
bn.total_key = 'TOTAL'
bn.format = '{seconds:>10.4f} {key}'
See also: bn.py:test().
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bn-0.1.4.tar.gz
(1.9 kB
view details)
File details
Details for the file bn-0.1.4.tar.gz.
File metadata
- Download URL: bn-0.1.4.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02a0eab22479258e69097a085f83e62328bf8fa3730897f04af2ded91edb8adf
|
|
| MD5 |
489cc171d9c154e258a37f2d82731919
|
|
| BLAKE2b-256 |
29906336fac6fa83b7151221c15012b43a1f15868150a89742428f0cd7611892
|