Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Time code execution and graph results

Project description


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:

  1. Time the code by using the timer provided. Usual usage is repeat, as timeit only times the functions once and skips step 2.
  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.
  3. Plot the data on the graph. This by default uses matplotlib via the MatPlotLib 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:
        return a

fig, axs = plt.subplots()
        .repeat(100, 5, list(range(0, 10001, 1000)), args_conv=range)


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.

Filename, size & hash SHA256 hash help File type Python version Upload date
graphtimer-0.0.4-py3-none-any.whl (7.5 kB) Copy SHA256 hash SHA256 Wheel py3
graphtimer-0.0.4.tar.gz (5.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page