This project has been archived by its maintainers, and is no longer receiving any updates.
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>...)wherefunctionis any function from your Python file andris the number of times to run it. Prints average execution time. -
speed.getSpeed(function, r, <optional>, <extra>, <args>...)again,functionis any function from your Python file andris 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
Release files for execspeed 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| execspeed-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| execspeed-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / execspeed-0.1.0.tar.gz
| Download URL | execspeed-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d983d5aa526459afa060f472a7c127ab2307c1227f76ca403a592a6956809549
|
|
BLAKE2b-256 checksum How to use checksums |
d04896432ec02a44a4147699c0d2ddd039b41cf6e882ad3f06ca40e59ea5f99e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / execspeed-0.1.0-py3-none-any.whl
| Download URL | execspeed-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b04d90075fed6d7de564820c8bf84d39b7d3c1cf50d743f443c66dd5f4a6c73
|
|
BLAKE2b-256 checksum How to use checksums |
ab8c1d593576e40ac989c02e99d16eb42f3ef655bb09121d58292dcf66f80923
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|