diff --git a/.vscode/settings.json b/.vscode/settings.json index 3391649d..cdaf5cd5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ ], "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, + "python.testing.cwd": "${workspaceFolder}", "explorer.autoRevealExclude": { ".mypy_cache": true, ".venv": true, @@ -51,7 +52,6 @@ "python.createEnvironment.contentButton": "show", "python.envFile": "${workspaceFolder}/.env", "python.terminal.launchArgs": [], - "python.testing.cwd": "${workspaceFolder}", "python.testing.autoTestDiscoverOnSaveEnabled": true, "pylint.cwd": "${workspaceFolder}/src", "codeQL.createQuery.qlPackLocation": "{$workspaceFolder}", diff --git a/CHANGELOG.md b/CHANGELOG.md index 9238a528..30b6a30b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ SimpleBench A framework for building and running benchmarks. +* 0.5.0-alpha-0 2025-11-30 + * Extended CSVReporter and RichTableReporter to allow customization + of output columns using options. + * Added checked support for explict parameters in benchmark functions. + * Completed documentation for parameterized benchmarks. + * 0.4.1-alpha.0 2025-11-29 - Seventh alpha release * **Documentation Update** * Migration of README to .rst format diff --git a/README.rst b/README.rst index a18e59a3..41da17c8 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ SimpleBench =========== -**SimpleBench** is a Python framework for benchmarking and performance testing of code. +**SimpleBench** is a modern Python framework for benchmarking and performance testing of code. As such it has the following goals: @@ -48,7 +48,8 @@ Documentation * `Installation `_ * `Using SimpleBench `_ * `Tutorials `_ - * `Basic Usage Tutorial `_ + * `Basic Benchmark `_ + * `Parameterized Benchmark `_ * `Command-Line Options `_ * `Reports `_ * `Rich Table Report `_ diff --git a/docs/_downloads/88e7aae14d90ceb1db4850c2e54e5bc2/minimal_parameterized_benchmark.py b/docs/_downloads/88e7aae14d90ceb1db4850c2e54e5bc2/minimal_parameterized_benchmark.py new file mode 100644 index 00000000..97a0df63 --- /dev/null +++ b/docs/_downloads/88e7aae14d90ceb1db4850c2e54e5bc2/minimal_parameterized_benchmark.py @@ -0,0 +1,14 @@ +"""A basic parameterized benchmark.""" +import simplebench + + +@simplebench.benchmark(kwargs_variations={'size': [1, 5, 10, 50, 100, 500, 1000]}, + variation_cols={'size': 'Input Size'}, + use_field_for_n='size') +def addition_benchmark(size: int) -> None: + """A simple addition benchmark of Python's built-in sum function.""" + sum(range(size)) + + +if __name__ == "__main__": + simplebench.main() diff --git a/docs/_downloads/f8498575ecb8c45b1316b8a0fefda355/multidimensional_parameterized_benchmark.py b/docs/_downloads/f8498575ecb8c45b1316b8a0fefda355/multidimensional_parameterized_benchmark.py new file mode 100644 index 00000000..add434fc --- /dev/null +++ b/docs/_downloads/f8498575ecb8c45b1316b8a0fefda355/multidimensional_parameterized_benchmark.py @@ -0,0 +1,27 @@ +"""A multidimensional parameterized benchmark.""" +import simplebench + + +@simplebench.benchmark( + kwargs_variations={ + 'size': [10, 100, 1000], + 'mode': ['fast', 'slow'] + }, + variation_cols={ + 'size': 'Input Size', + 'mode': 'Mode' + }, + use_field_for_n='size') +def my_benchmark(size: int, mode: str) -> None: + """A benchmark for summing a range of numbers that varies by size and mode.""" + match mode: + case 'fast': + sum(range(size)) + case 'slow': + total = 0 + for i in range(size): + total += i + + +if __name__ == "__main__": + simplebench.main() diff --git a/docs/_modules/index.html b/docs/_modules/index.html index e2bd3d5c..1ba79bf8 100644 --- a/docs/_modules/index.html +++ b/docs/_modules/index.html @@ -5,13 +5,13 @@ - Overview: module code - simplebench 0.4.0-alpha.0 documentation + Overview: module code - simplebench 0.4.1-alpha.0 documentation - + @@ -163,7 +163,7 @@ diff --git a/docs/_modules/simplebench/case.html b/docs/_modules/simplebench/case.html index c4c45e61..496e5a0e 100644 --- a/docs/_modules/simplebench/case.html +++ b/docs/_modules/simplebench/case.html @@ -5,12 +5,13 @@ - simplebench.case - simplebench 0.4.0-alpha.0 documentation + simplebench.case - simplebench 0.4.1-alpha.0 documentation + - + @@ -162,7 +163,7 @@
@@ -183,7 +184,7 @@