The Python Performance Tuner
Project description
# PPT - The Python Performance Tuner
`ppt` is a tool for tuning the performance of Python programs.
## Install
~~~shell
pip install ppt
~~~
## Example
~~~python
import ppt
import time
if __name__ == '__main__':
for _ in range(10):
ppt.time('big')
time.sleep(0.5) # Big computation
ppt.time('medium')
time.sleep(0.3) # Medium computation
ppt.time('fast')
time.sleep(0.01) # Fast computation
# Stop current timing
ppt.stop()
# Print current timings
ppt.summary()
# Detailed statistics from pstats
ppt.stats()
~~~
**Output**
~~~
big: 40 function calls in 5.006 seconds
medium: 40 function calls in 3.003 seconds
fast: 40 function calls in 0.101 seconds
********** big **********
40 function calls in 5.006 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 5.005 0.501 5.005 0.501 {built-in method time.sleep}
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
********** medium **********
40 function calls in 3.003 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 3.003 0.300 3.003 0.300 {built-in method time.sleep}
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
********** fast **********
40 function calls in 0.101 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 0.101 0.010 0.101 0.010 {built-in method time.sleep}
9 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
1 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:53(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
~~~
`ppt` is a tool for tuning the performance of Python programs.
## Install
~~~shell
pip install ppt
~~~
## Example
~~~python
import ppt
import time
if __name__ == '__main__':
for _ in range(10):
ppt.time('big')
time.sleep(0.5) # Big computation
ppt.time('medium')
time.sleep(0.3) # Medium computation
ppt.time('fast')
time.sleep(0.01) # Fast computation
# Stop current timing
ppt.stop()
# Print current timings
ppt.summary()
# Detailed statistics from pstats
ppt.stats()
~~~
**Output**
~~~
big: 40 function calls in 5.006 seconds
medium: 40 function calls in 3.003 seconds
fast: 40 function calls in 0.101 seconds
********** big **********
40 function calls in 5.006 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 5.005 0.501 5.005 0.501 {built-in method time.sleep}
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
********** medium **********
40 function calls in 3.003 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 3.003 0.300 3.003 0.300 {built-in method time.sleep}
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
********** fast **********
40 function calls in 0.101 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
10 0.101 0.010 0.101 0.010 {built-in method time.sleep}
9 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:42(time)
10 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:17(stop)
1 0.000 0.000 0.000 0.000 /home/seba-1511/Dropbox/Dev/perf/ppt/profiler.py:53(stop)
10 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
~~~
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ppt-0.0.3.tar.gz
(2.7 kB
view hashes)