Time code execution and graph results
Project description
graphtimer
This library is based around generating nice graphs for timings. It's highly modular and provides an interface to quickly and cleanly use modules.
The high-level interface is the Plotter
class which takes a timer class as its only argument. The builtin timer is MultiTimer
, where TimerNamespace
builds it without you having to.
From here you have three steps:
- Time the code by using the timer provided. Usual usage is
repeat
, astimeit
only times the functions once and skips step 2. - Perform the statistical analysis on the timings. Most of the time you'll want to use
min
, which gets the lowest value that isn't an outlier. And shows the error bars from the lowest outlier to Q3. - Plot the data on the graph. This by default uses
matplotlib
via theMatPlotLib
class.
import matplotlib.pyplot as plt
from graphtimer import Plotter, TimerNamespace
class ManualListCreation(TimerNamespace):
def test_comprehension(iterable):
return [i for i in iterable]
def test_append(iterable):
a = []
append = a.append
for i in iterable:
append(i)
return a
fig, axs = plt.subplots()
(
Plotter(ManualListCreation)
.repeat(100, 5, list(range(0, 10001, 1000)), args_conv=range)
.min()
.plot(axs)
)
fig.show()
Installation
To install graphtimer, just use pip:
$ pip install graphtimer
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
graphtimer-0.0.4.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file graphtimer-0.0.4.tar.gz
.
File metadata
- Download URL: graphtimer-0.0.4.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa9d7c9f00c7043c3bdf78e24f21d591c66efa4f22d6768b8f52fe9a00afad3 |
|
MD5 | 8d4504a5d7769a3e9959fcdb674a1238 |
|
BLAKE2b-256 | d0ed9f8a2b72aae9463830039d4dbe54e1fcdb391e284e53ece6b4d0877cb490 |
File details
Details for the file graphtimer-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: graphtimer-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c1cfe6b53e1d245f9e2ce170db771c50a186dfb5294e97087650b7dc998d437 |
|
MD5 | 948ee6783911c6302e6d8d85413b9499 |
|
BLAKE2b-256 | 74ea114d791ed599de59935671a09177ff6b6daaad4c86906b8e28a8010b46d7 |