tepet

Small timing tool to run performance analysis


Keywords
performance, performance-testing, python, python3, utility
License
MIT
Install
pip install tepet==0.1.1

Documentation

tepet

TEmporal PErformance Tool

25-cent term for a 5-cent concept!

PyPI Test Python package

What is this

tepet is a small utility to help you understand and track execution time of your code. You could write it anytime, but why do this every other day?

Usage

Can be used as a context manager

from tepet import PerfTimer

with PerfTimer():
    print('doing stuff...')

# Output:
#
# > 2020 May 31 20:11:49 +0000 ==== started
# > doing stuff...
# > 2020 May 31 20:11:49 +0000 ==== elapsed 0.00000 seconds

and a function decorator

from tepet import PerfTimer
@PerfTimer()
def work():
  print("working...")

work()

# Output:
#
# > 2020 May 31 20:14:25 +0000 ==== started
# > working...
# > 2020 May 31 20:14:25 +0000 ==== elapsed 0.00001 seconds

Also, can be used in production environments for naive tracking:

from tepet import Timer

def printer(seconds):
        print(f'code block 1: {seconds:.5f} elapsed')

with Timer(printer):
    ...

# Output:
# > code block 1: 0.00000 elapsed