[ANN] Benchmarker 1.1.0 released - a samll benchmark utility

Makoto Kuwata kwa at kuwata-lab.com
Sat Jun 26 19:05:38 EDT 2010


Terry,
Thank you for trying Benchmarker.

On Sun, Jun 27, 2010 at 7:15 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> On 6/26/2010 1:09 PM, Makoto Kuwata wrote:
>>
>> I released Benchmarker 1.1.0.
>> http://pypi.python.org/pypi/Benchmarker/
>>
>> Benchmarker is a small utility to benchmark your code.
>>
>>
>> Example
>> =======
>>
>> ex.py::
>>
>>     def fib(n):
>>         return n<= 2 and 1 or fib(n-1) + fib(n-2)
>>     from benchmarker import Benchmarker
>>     bm = Benchmarker(30)  # or Benchmarker(width=30, out=sys.stderr,
>> header=True)
>>     ## Python 2.5 or later
>
> Is that 2.5 to 2.7 or 2.5 to 3.1 and later?
>
>

2.5 to 3.1 and later, because with-statement is available 2.5, 2.6,
2.7, and 3.x.

Benchmarker supports two styles to invoke.
One is using with-statement and this is available 2.5, 2.6, 2.7, and 3.x.

  bm = Benchmarker()
  with bm('fib(30)'): fib(30)

The other is to call run() method and this is available every version of Python.

  bm = Benchmarker()
  bm('fib(30)').run(fib, 30)


Thank you for your attention.

--
regards,
makoto kuwata



More information about the Python-list mailing list