Hi, I released Benchmarker 3.0.1. http://pypi.python.org/pypi/Benchmarker/
Benchmarker is a small utility to benchmark your code. *NOTICE* This release doesn't have compatibility with release 2.0.0. Download -------- http://pypi.python.org/pypi/Benchmarker/ Installation:: ## if you have installed easy_install: $ sudo easy_install Benchmarker ## or download Benchmarker-3.0.1.tar.gz and install it $ wget http://pypi.python.org/packages/source/B/Benchmarker/Benchmarker-3.0.1.tar.gz $ tar xzf Benchmarker-3.0.1.tar.gz $ cd Benchmarker-3.0.1/ $ sudo python setup.py install Example ------- ex0.py:: from benchmarker import Benchmarker, cmdopt cmdopt.parse() s1, s2, s3, s4, s5 = "Haruhi", "Mikuru", "Yuki", "Itsuki", "Kyon" with Benchmarker(width=20, loop=1000*1000) as bm: for _ in bm.empty(): ## empty loop pass for _ in bm('join'): sos = ''.join((s1, s2, s3, s4, s5)) for _ in bm('concat'): sos = s1 + s2 + s3 + s4 + s5 for _ in bm('format'): sos = '%s%s%s%s%s' % (s1, s2, s3, s4, s5) Output example:: $ python ex0.py -h # show help message of command-line optins $ python ex0.py ## benchmarker: release 3.0.1 (for python) ## python platform: darwin [GCC 4.2.1 (Apple Inc. build 5664)] ## python version: 2.7.1 ## python executable: /usr/local/python/2.7.1/bin/python ## user sys total real (Empty) 0.1600 0.0000 0.1600 0.1639 join 0.6500 0.0000 0.6500 0.6483 concat 0.5700 0.0000 0.5700 0.5711 format 0.7600 0.0000 0.7600 0.7568 ## Ranking real concat 0.5711 (100.0%) ************************* join 0.6483 ( 88.1%) ********************** format 0.7568 ( 75.5%) ******************* ## Ratio Matrix real [01] [02] [03] [01] concat 0.5711 100.0% 113.5% 132.5% [02] join 0.6483 88.1% 100.0% 116.7% [03] format 0.7568 75.5% 85.7% 100.0% Notice that empty loop times (user, sys, total, and real) are subtracted from other benchmark times automatically. For example:: =================================================== benchmark label real (second) --------------------------------------------------- join 0.6483 (= 0.8122 - 0.1639) concat 0.5711 (= 0.7350 - 0.1639) format 0.7568 (= 0.9207 - 0.1639) =================================================== See http://pypi.python.org/pypi/Benchmarker/ for details. Changes on release 3.0.1 ------------------------ * License is changed again to Public Domain. * Change Task class to pass 1-origin index to yield block when 'for _ in bm()' . * Fix a bug that 'for _ in bm()' raised error when loop count was not specified. * Fix a bug that 'for _ in bm()' raised RuntimeError on Python 3. Changes on release 3.0.0 ------------------------ * Rewrite entirely. * Enhanced to support command-line options. :: import benchmarker benchmarker.cmdopt.parse() You can show all command-line options by ``python file.py -h``. See README file for details. * Benchmarker.repeat() is obsolete. :: ## Old (obsolete) with Benchmarker() as bm: for b in bm.repeat(5, 1): with b('bench1'): .... ## New for bm in Benchmarker(repeat=5, extra=1): with bm('bench1'): .... * Changed to specify time (second) format. :: import benchmarker benchmarker.format.label_with = 30 benchmarker.format.time = '%9.4f' * Followings are removed. * Benchmark.stat * Benchmark.compared_matrix() * Benchmark.print_compared_matrix() Have fun! -- regards, makoto kuwata -- http://mail.python.org/mailman/listinfo/python-list