Skip to content

Tiny package to help you measure the execution time (in milliseconds) of functions

License

Notifications You must be signed in to change notification settings

mrvaibh/python-code-execution-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exec-time documentation

"kamaal hai!, ab DOCS bhi mai hi likhu? "

exec-time is a very tiny package which provides a decorator that helps you measure the execution time (in milliseconds) of functions.

PYPI official page: https://pypi.org/project/exec-time/

image image

Installation

You should be able to install using pip in the usual ways:

$ pip install exec-time

Or just clone this repository and run:

$ python setup.py install

Or place the [exec-time]{.title-ref} folder that you downloaded somewhere where it can be accessed by your scripts.

Usage

Add your code snippets in first_func and second_func respectively for comparison

# === USAGE ===
@exec_time
def first_func():
    '''Here goes function 1'''
    x = 0
    for i in range(1, 10001):
        x += 10

@exec_time
def second_func():
    '''Here goes function 2'''
    x = 0
    for i in range(1, 101):
        x += 10

first_func()
second_func()
# === OUTPUT ===
# first_func function executed in : 0.32839999767020345 mil sec
# second_func function executed in : 0.006199989002197981 mil sec

That's it, enjoy 🍷

About

Tiny package to help you measure the execution time (in milliseconds) of functions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages