Skip to main content

Benchmark your code while unit testing them

Project description

Benchmark your code while unit testing them

Usecases

  1. Problem solving. To quickly check different implementations and compare versions to find which one performs better.
  2. Quick algorithm mockup. Again, to quickly check different approaches and implementations and compare versions to find which one performs better.

What it does not provide insights about

  1. Overall performance score of your application.
  2. Algorithmic complexity.
import time
import test_timer


def function_a():
    ...


def function_b():
    time.sleep(1)


class TestSrc(test_timer.BenchTestCase):
    def test_function_a(self):
        function_a()

    def test_function_b(self):
        function_b()

if __name__ == "__main__":
    test_timer.main()
test_function_a (__main__.TestSrc): 0:00:00.000052
.
test_function_b (__main__.TestSrc): 0:00:01.001192
.
----------------------------------------------------------------------
Ran 2 tests in 1.002s

OK

How to install:

pip install test_timer

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

test_timer-0.0.2.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

test_timer-0.0.2-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file test_timer-0.0.2.tar.gz.

File metadata

  • Download URL: test_timer-0.0.2.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.11.0-43-generic

File hashes

Hashes for test_timer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bc2105bd9e8b96e78f3094ce3fd4cd057c545fe7fb1bc605e17888a45fa13bbe
MD5 955a3a97ca083ab021361a5002d2d43e
BLAKE2b-256 43b67c9244d809e9dcd00c9bdc6a7beaa0a44fb7057fbfeb7eb557026440fc62

See more details on using hashes here.

File details

Details for the file test_timer-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: test_timer-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.8.10 Linux/5.11.0-43-generic

File hashes

Hashes for test_timer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce12b6e0fcf70bebf23728cd0ca3790325e073fe1b9aa0387808bae5a0d5879e
MD5 eb3f19b49a6555cb04fcd414902cd854
BLAKE2b-256 e02fc5b314915833e42cfee76b5618ac7358e072fce9b335a01963f9c3e81566

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