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 (http://jspi.es/benchmark) 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 http://jspies.com/benchmark 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.0.tar.gz (6.4 kB view details)

Uploaded Source

File details

Details for the file benchmark-0.1.0.tar.gz.

File metadata

  • Download URL: benchmark-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for benchmark-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a6c79d89ba55d739ed1297ee6f951a67755b389e7ca2cccf37e0086638dff0d0
MD5 f613976503de0b6f6cdf76e0b4137f1f
BLAKE2b-256 ee60b058ba38853dcb6ed8af261551d5afc6c610a66f0d241646dae4daeccb76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page