Skip to main content

Is an simple bench tool.

Project description

benchtools

A small project written in C, with a modular port to python. Performs benchmarks using functions.

GitHub-BenchTools GitHub-Issues

Use example:

from benchtools import set_bench, bench_round, clear_round
from typing import Any

create functions to bench

all functions using this template

def myfuncName() -> None:
    "Your code here"

no args, no return.

if your execution recive args. encapsule it an parse the args properly.

def myfuncNameWithArgs(arg1, arg2, arg3) -> Any:
    "Your code here"

example to encapsule

myfuncNameWithArgsCorrect = lambda : myfuncNameWithArgs('arg1', 'arg2', 'arg3')

after it, you set the functions to bench table, make it calling set_bench

set_bench(myfuncName, "beatifull alias", 4)

the first argument is your callable

the second is an alias for view

the third is an number of executions to get an average time, if 0 the function not is executed!

set_bench(myfuncNameWithArgsCorrect, "second beatifull alias", 1)
set_bench(myfuncNameWithArgsCorrect, "another beatifull alias", 0) # this not execute!

after it, you like to benchmark, make it calling bench_round

bench_round()

if you like to save the results, set True

bench_round(True)

the file is benchmark.log.csv (comma separated, indexed)

in the end, to reset the benchmark system call clear_round

clear_round()

free to set new bench function

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

BenchTools-1.0.3.post1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

BenchTools-1.0.3.post1-cp310-cp310-win_amd64.whl (9.3 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file BenchTools-1.0.3.post1.tar.gz.

File metadata

  • Download URL: BenchTools-1.0.3.post1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for BenchTools-1.0.3.post1.tar.gz
Algorithm Hash digest
SHA256 6cc95bbf6f329106e1659b554dc65bc29b4d0ae44052a1ae9776eeebe9a90489
MD5 019fb041fd5455127e99e81958cd6938
BLAKE2b-256 2054d63887c745da4fe3654473223020907796cb0a6441b7c368c2c39debbc76

See more details on using hashes here.

File details

Details for the file BenchTools-1.0.3.post1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for BenchTools-1.0.3.post1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 45b9855aab9f9d21e317feb3e5fb3fe23c11e89828b4e27fd37f70a32569ac77
MD5 6a29d5116812bdc98b08528fb732eeb3
BLAKE2b-256 720e24e35c3ffe0824b4bfe3c5f58dee45c71ab5d5801857301948fe8aa820fc

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