sloth/docs

The python speedtesting library

sloth is a Python package for speedtesting python code and functions with as little code as necessary. It’s easy to use and, unlike many projects, has decent documentation.

The idea behind this API is:

>>> from sloth import compare_sloth
>>> import timeit
>>> compare_sloth(timeit)
'sloth is loads better than timeit!'

See? described in 3 lines. Everything that timeit can do, sloth can do better. And most (speedtest-related) things timeit can’t do sloth can do anyway.

Or, for the bash ninjas and command liners:

$ sloth compare timeit
sloth is loads better than timeit!
$ python3 -m sloth compare timeit
sloth is loads better than timeit!

A Quick Example

>>> from sloth.simple import time_callable
>>> import time
>>> def my_func(a, b, c):
...     time.sleep(1)
...     print(a, b, c)
>>> time_callable(my_func, 2, 'a', 'b', 'c')
a b c
1.000063419342041

Installation

You can install sloth with pip:

pip install sloth-speedtest

Please see Installation for more information.

Usage

Please see the The sloth API for API usage guidance. Please run sloth -h or sloth --help for help with the command line tool.

Indices and Tables