Skip to content

Commit d14aab8

Browse files
committed
Add benchmarks/README.md and mention it in main README.md
1 parent f899d9c commit d14aab8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ $ make html
2525

2626
The index page is at `docs/_build/html/index.html` - you can open this in a web browser.
2727

28+
## Tests and benchmarks
29+
30+
Please see `tests/README.md` and `benchmarks/README.md` for more information.
31+
2832
## Releases/versioning
2933

3034
Releases are created using tags from the repository and can be found on [PyPI](https://pypi.org/project/constrainedrandom/).

benchmarks/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Benchmarks
2+
3+
These benchmarks are intended as developer-facing. They contain checks to ensure that performance has not degraded.
4+
5+
## Extra requirements
6+
7+
You need to install [`pyvsc`](https://pyvsc.readthedocs.io/en/latest/introduction.html) in order to run the benchmarks. This is not included in `pyproject.toml` as a dependency to avoid making installation size bigger than necessary.
8+
9+
## Running
10+
11+
To run, from the root of constrainedrandom:
12+
13+
```
14+
python3 -m benchmarks
15+
```
16+
17+
## Defining new benchmarks
18+
19+
Benchmark test cases should inherit from `benchmarks.benchmark_utils.BenchmarkTestCase`.
20+
21+
Each test case should implement a `get_randobjs()` method. This returns a dictionary of the random objects to be tested. Each should implement the `randomize()` function and be equivalent.
22+
23+
Each test case should also implement a `check_perf()` method, so that the expected results are defined in an executable, checkable manner.
24+
25+
## Shared framework
26+
27+
The benchmarks use a shared testing framework with the unit tests. However, they are kept separate so that users don't have to install `pyvsc` to ensure basic functionality of constrainedrandom.

0 commit comments

Comments
 (0)