gtimeit
Graphical code timer, and function time usage tracker. A tool for python functions. Time and compare your functions inside or outside a program.
Installation
Installing as library
The easiest way is to use pip.
# install the library with plotting capabilities (requires matplotlib)
pip install gtimeit[plot]
# or without
pip install gtimeit
You can now import the tools in your code.
from gtimeit import Benchmark
from gtimeit import execTimeList, display_performances
Installing for developpement
Or you can install from Github.
git clone https://github.com/Chthi/gtimeit
cd gtimeit
pip install --editable ".[plot,dev]"
Benchmark
Allows to run multiple python functions a certain amount of times and to compare there respective execution times. Similar to timeit Display curves of all the execution times. Prototype : benchmarking for complexity tests up to one variable parameter. The variable take all the values of a given range and the benchmarck keeps track of the executions times.
Usage :
bm = Benchmark()
bm.add(fct1, *args, **kwargs)
bm.add(fct2, *args, **kwargs)
bm.add(fctn, *args, **kwargs)
bm.run(20, multiplicator=100)
Quick usage :
bm = Benchmark([fct1, fct2], 300)
Examples
More examples available in benchmark_examples.py.
def plusEgale(i=1):
i += 1
return i
def plusPuisEgale(i=1):
i = i + 1
return i
# running 200 tests 100000 times each
bm = Benchmark()
bm.add(plusEgale, 42)
bm.add(plusPuisEgale, 42)
bm.run(200, multiplicator=100000)
# short version for procedures
bm = Benchmark([plusEgale, plusPuisEgale], 200, multiplicator=100000)
Tracker
Allow to keep track of the execution time of some functions in a program. Useful to know which part of your program take the more time to execute.
Usage
Use the decorator @execTimeList before every function you want to keep track of.
The execution time of a function is defined by the total execution time of the code and of the functions called inside that are not taged with @execTimeList.
Use display_performances() to display the results.
Examples
from gtimeit import execTimeList, display_performances
@execTimeList
def additions():
i = 0
for x in range(1,100000):
i += 1
@execTimeList
def sumrange():
sum(range(1,100000))
@execTimeList
def extending():
l = []
for x in range(1,100000):
l.extend([0])
@execTimeList
def fct1():
extending()
sumrange()
# simulate some basic code
for x in range(4):
additions()
sumrange()
extending()
for x in range(2):
sumrange()
extending()
for x in range(10):
additions()
fct1()
display_performances()
Limitations
For the current version :
- It is not possible to use
BenchmarkandexecTimeListdecorator at the same time on one object as the decorator replace the function name bytimed. - Recursive tracked functions are not supported. If a function decorated with
@execTimeListcalls itself (directly or through mutual recursion) on the same thread, its exclusive time is misattributed: the accumulated durations all collapse onto the innermost call while the outer frames are left at zero. The number of calls,wall_durationand total time stay correct; only the exclusive-time views (pie chart, timeline) are affected.
Release files for gtimeit 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gtimeit-0.0.6.tar.gz | 10.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gtimeit-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.8 kB
Release files / gtimeit-0.0.6.tar.gz
| Download URL | gtimeit-0.0.6.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c89545195481e43783887ba3a575e84a5a2dffb31bdf6b386d1f5d772878deb
|
|
BLAKE2b-256 checksum How to use checksums |
e98aa2d72ba303e9c1fdfd8e97a5dc0d3b6d96b1b34be6acd92f61295a97d885
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency logRelease files / gtimeit-0.0.6-py3-none-any.whl
| Download URL | gtimeit-0.0.6-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
177a2d054e493b5d6b236da6ed27503aac9c9aab239ae318f443677f0e7fce67
|
|
BLAKE2b-256 checksum How to use checksums |
0d5cd70b629bc36f9fbe501bf1828e1944fd4b89bb78762efa312444ebc07f9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 18, 2026.
Transparency log