Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82562

ANN: Benchmarker 4.0.0 released - small but awesome benchmark utility

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <kwatch@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'url:pypi': 0.03; 'output': 0.05; 'python)': 0.05; 'subject:ANN': 0.07; 'subject:released': 0.07; 'sys': 0.07; '------------': 0.09; 'python': 0.11; 'def': 0.12; '-------': 0.16; '6.0': 0.16; '[01]': 0.16; '[02]': 0.16; '[03]': 0.16; 'concat': 0.16; 'platform:': 0.16; 'skip:@ 20': 0.16; 'skip:j 30': 0.16; 'sudo': 0.16; 'sender:addr:gmail.com': 0.17; 'code.': 0.18; 'skip:f 30': 0.19; 'example': 0.22; 'import': 0.22; 'to:name:python-list@python.org': 0.22; 'install': 0.23; 'installation': 0.23; 'pass': 0.26; '(for': 0.26; "doesn't": 0.30; 'label': 0.30; 'skip:@ 10': 0.30; 'message-id:@mail.gmail.com': 0.30; 'gcc': 0.31; 'compatible': 0.32; 'skip:c 30': 0.32; 'skip:m 30': 0.32; 'url:python': 0.33; 'message.': 0.35; 'skip:- 50': 0.35; 'received:google.com': 0.35; '8bit%:80': 0.36; 'skip:f 40': 0.36; 'version:': 0.36; 'url:org': 0.36; 'skip:& 10': 0.38; 'apple': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'release': 0.40; '8bit%:47': 0.60; 'skip:\xc2 10': 0.60; 'details.': 0.61; 'skip:* 10': 0.61; 'times': 0.62; 'show': 0.63; 'real': 0.63; '8bit%:74': 0.68; '8bit%:84': 0.69; 'skip:r 30': 0.69; 'user,': 0.69; '8bit%:96': 0.70; '8bit%:100': 0.72; '8bit%:27': 0.74; '8bit%:57': 0.74; '(total': 0.84; '4.2.1': 0.84; '8bit%:77': 0.84; '8bit%:82': 0.84; 'benchmark': 0.84; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.84; '8bit%:56': 0.91; '8bit%:90': 0.93; 'fun!': 0.93; 'ranking': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=qMFRvDwHSX8bsLqhOHp7TUYRUgslMAeBwXwaqeiIdZg=; b=Gwc5W0Lnt8lCqWcVn0bTsmztzj4WobCDZRG8NBCiNNedZl9/u+zrTbzY1acY0dZgGK 3gFVynPL38ajjnRcSttcEc3c5XfPHqawvO4ExJNtM4MsdldS/xiE9JeIgvGRV2NVk846 vAw/7JseVFMx7qMwnWA1DZWh5wBJ0PwrL1w1Jw5Uxn+CYEAxT+2znmvMMZvoKWm4vo4e PZut/kFsXXIEkHGJsnWWN0PJaFMfHT3FA8HkexxZ+lseVYTapyHFTnf+aggdbpCizhoE hq/iyuE4KkVv8KH6W5SmoxEorKm1+xgzsG3OmcXJfS1KeH7WFi3UcPbXkVLPRbAbbIr5 MO7g==
MIME-Version 1.0
X-Received by 10.50.43.198 with SMTP id y6mr17575325igl.48.1418647406407; Mon, 15 Dec 2014 04:43:26 -0800 (PST)
Sender kwatch@gmail.com
Date Mon, 15 Dec 2014 21:43:26 +0900
X-Google-Sender-Auth -QzWzce-Uz_tdKIy5412_AcIq2k
Subject ANN: Benchmarker 4.0.0 released - small but awesome benchmark utility
From Makoto Kuwata <kwa@kuwata-lab.com>
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=089e01537a96b87525050a4096ea
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16983.1418647414.18130.python-list@python.org> (permalink)
Lines 178
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418647414 news.xs4all.nl 2888 [2001:888:2000:d::a6]:46188
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82562

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

I released Benchmarker ver 4.0.0
http://pypi.python.org/pypi/Benchmarker/
http://pythonhosted.org/Benchmarker/

Benchmarker is a small utility to benchmark your code.

*NOTICE* This release doesn't have compatibility with ver 3.x.


Installation
------------

    $ sudo pip install Benchmarker


Example
-------

example.py::

    from benchmarker import Benchmarker

    with Benchmarker(1000*1000, width=20) as bench:

        s1, s2, s3, s4, s5 = "Haruhi", "Mikuru", "Yuki", "Itsuki", "Kyon"

        @bench(None)
        def _(bm):
            for _ in bm:       ## empty loop
                pass

        @bench("concat")
        def _(bm):
            for _ in bm:
                s = s1 + s2 + s3 + s4 + s5

        @bench("join")
        def _(bm):
            for _ in bm:
                s = "".join((s1, s2, s3, s4, s5))

        @bench("format")
        def _(bm):
            for _ in bm:
                s = "%s%s%s%s%s" % (s1, s2, s3, s4, s5)

Output example::

    $ python example.py -h  # show help message.
    $ python example.py  # or python example.py -n 1000000
    ## benchmarker:         release 4.0.0 (for python)
    ## python version:      3.4.1
    ## python compiler:     GCC 4.2.1 Compatible Apple LLVM 6.0
(clang-600.0.51)
    ## python platform:     Darwin-14.0.0-x86_64-i386-64bit
    ## python executable:   /usr/local/bin/python
    ## cpu model:           Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz
    ## parameters:          loop=1000000, cycle=1, extra=0

    ##                        real    (total    = user    + sys)
    (Empty)                 0.0335    0.0300    0.0300    0.0000
    concat                  0.4192    0.4200    0.4100    0.0100
    join                    0.3674    0.3700    0.3700    0.0000
    format                  0.4765    0.4600    0.4600    0.0000

    ## Ranking                real
    join                    0.3674  (100.0) ********************
    concat                  0.4192  ( 87.6) ******************
    format                  0.4765  ( 77.1) ***************

    ## Matrix                 real    [01]    [02]    [03]
    [01] join               0.3674   100.0   114.1   129.7
    [02] concat             0.4192    87.6   100.0   113.7
    [03] format             0.4765    77.1    88.0   100.0

Notice that empty loop times (real, user, sys and total) are
subtracted from other benchmark times automatically.
For example::

    ===================================================
     benchmark label        real (second)
    ---------------------------------------------------
     join                   0.3674 (= 0.4009 - 0.0335)
     concat                 0.4192 (= 0.4527 - 0.0335)
     format                 0.4765 (= 0.5100 - 0.0335)
    ===================================================


See http://pythonhosted.org/Benchmarker/ for details.


Have fun!

--
regards,
makoto kuwata

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

ANN: Benchmarker 4.0.0 released - small but awesome benchmark utility Makoto Kuwata <kwa@kuwata-lab.com> - 2014-12-15 21:43 +0900

csiph-web