Skip to main content

Python benchmarker/benchmarking framework

Project description

benchmark is a Python benchmarking framework, similar to Steve Purcell’s unittest in basic structure. It’s as simple as:

import benchmark

import math

class Benchmark_Sqrt(benchmark.Benchmark):

    def test_pow_operator(self):
        for i in xrange(750000):
            z = i**.5

    def test_pow_function(self):
        for i in xrange(750000):
            z = pow(i, .5)

    def test_sqrt_function(self):
        for i in xrange(750000):
            z = math.sqrt(i)

if __name__ == '__main__':
    benchmark.main(each=50, format="markdown")

which produces:

Benchmark Report

Benchmark Sqrt

         name | rank | runs |           mean |               sd
 pow operator |    1 |   50 | 0.113651094437 | 0.00709087316343
sqrt function |    2 |   50 | 0.151987323761 | 0.00658830515608
 pow function |    3 |   50 | 0.223314394951 |  0.0133163421349

The functions above were run in random, nonconsecutive order by
`benchmark` v0.1.0 ( with Python 2.7.1
Darwin-11.3.0-x86_64 on 2012-04-16 17:42:19.

More examples are available in the example folder or visit for more information.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchmark-0.1.1.tar.gz (6.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page