Simple tool for finding average function execution time
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
PyExecSpeed
A simple package for calculating the execution time of a function in a Python file
Usage:
Installation
pip install execspeed
Using
-
speed.showSpeed(function, r, <optional>, <extra>, <args>...)
wherefunction
is any function from your Python file andr
is the number of times to run it. Prints average execution time. -
speed.getSpeed(function, r, <optional>, <extra>, <args>...)
again,function
is any function from your Python file andr
is the number of times to run it. Returns average execution time as a float.
Example:
import speed
def myFunc(start, message):
x = start
for i in range(100):
x *= i
print(f"{message} {x}")
n = 10
speed.showSpeed(myFunc, n, 3, "Your number is:")
# Repeats myFunc n (= 10) times and prints the average execution time.
# Passed (3) and "Your number is:" to myFunc() -- any number of arguments can now be passed to your function this way
# A higher value of n will likely result in a more accurate value, but will take longer.
>>> 0.00003339
Notes:
- The output from
getSpeed()
is a float. - While
showSpeed()
orgetSpeed()
run a function, they block printing within that function so the terminal isn't filled with potentially hundreds of prints.
Create an issue if you have any feedback / bugs you want to report
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
Built Distribution
File details
Details for the file execspeed-0.1.0.tar.gz
.
File metadata
- Download URL: execspeed-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d983d5aa526459afa060f472a7c127ab2307c1227f76ca403a592a6956809549
|
|
MD5 |
b23806cfd1a4682639aca1bd36f6109e
|
|
BLAKE2b-256 |
d04896432ec02a44a4147699c0d2ddd039b41cf6e882ad3f06ca40e59ea5f99e
|
File details
Details for the file execspeed-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: execspeed-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
8b04d90075fed6d7de564820c8bf84d39b7d3c1cf50d743f443c66dd5f4a6c73
|
|
MD5 |
cf45ec5b7501de5eed6c92c8167426d9
|
|
BLAKE2b-256 |
ab8c1d593576e40ac989c02e99d16eb42f3ef655bb09121d58292dcf66f80923
|