https://github.com/drkostas/bench-utils
A collection of benchmarking tools.
https://github.com/drkostas/bench-utils
benchmark benchmarking timer timit
Last synced: about 2 months ago
JSON representation
A collection of benchmarking tools.
- Host: GitHub
- URL: https://github.com/drkostas/bench-utils
- Owner: drkostas
- License: apache-2.0
- Created: 2021-12-21T15:23:31.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-30T01:42:26.000Z (over 3 years ago)
- Last Synced: 2025-03-15T12:11:28.182Z (2 months ago)
- Topics: benchmark, benchmarking, timer, timit
- Language: Python
- Homepage: https://pypi.org/project/bench-utils/
- Size: 41 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Benchmark Utilities
[](https://pepy.tech/project/bench-utils)
[](https://github.com/drkostas/bench-utils/blob/master/LICENSE)A collection of benchmarking
tools. [PYPI Package](https://pypi.org/project/bench-utils/)## Table of Contents
+ [Using the library](#using)
+ [Installing and using the library](#install_use)
+ [Manually install the library](#manual_install)
+ [Prerequisites](#prerequisites)
+ [Install the requirements](#installing_req)
+ [Update PyPI package](#pypi)
+ [License](#license)### Installing and using the library
First, you need to install the library either using pip:
```shell
$ pip install bench_utils
```Then, import it and use it like so:
```python
from bench_utils import timeit, profileit# --- Timeit --- #
# Context Manager
with timeit():
# A code block
pass@timeit()
def my_func():
# Function code
pass# --- Profileit --- #
# Context Manager
with profileit():
# A code block
pass@profileit()
def my_func():
# Function code
pass
```For more advanced examples
check [example_timeit.py](https://github.com/drkostas/bench-utils/blob/master/example_timeit.py)
and [example_profileit.py](https://github.com/drkostas/bench-utils/blob/master/example_profileit.py)
.## Manually install the library
These instructions will get you a copy of the project up and running on your local machine for
development and testing purposes.You need to have a machine with
[anaconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html) installed and
any Bash based shell (e.g. zsh) installed.```ShellSession
$ conda -V
conda 4.10.1$ echo $SHELL
/usr/bin/zsh```
All the installation steps are being handled by
the [Makefile](https://github.com/drkostas/bench-utils/blob/master/Makefile).First, modify the python version (`min_python`) and everything else you need in
the [settings.ini](https://github.com/drkostas/bench-utils/blob/master/settings.ini).Then, execute the following commands:
```ShellSession
$ make create_env
$ conda activate bench_utils
$ make dist
```Now you are ready to use and modify the library.
This is mainly for future reference for the developers of this project. First,
create a file called `~/.pypirc` with your pypi login details, as follows:```
[pypi]
username = your_pypi_username
password = your_pypi_password
```Then, modify the python version (`min_python`), project status (`status`), release version (`version`)
and everything else you need in
the [settings.ini](https://github.com/drkostas/bench-utils/blob/master/settings.ini).Finally, execute the following commands:
```ShellSession
$ make create_env
$ conda activate bench_utils
$ make release
```For a dev release, change the `testing_version` and instead of `make release`, run `make release_test`.
This project is licensed under the Apache License - see
the [LICENSE](https://github.com/drkostas/bench-utils/blob/master/LICENSE) file for details.