Skip to content

Benchmark libary - #518

Merged
HKaras merged 18 commits into
JeschkeLab:mainfrom
HKaras:Benchmark-Libary
Dec 3, 2026
Merged

HKaras merged 18 commits into
JeschkeLab:mainfrom
HKaras:Benchmark-Libary

Conversation

@HKaras

@HKaras HKaras commented Dec 3, 2026

Copy link
Copy Markdown
Member

This pull request has no affect on the main code

In this pull request we add a benchmarking library using pytest-benchmark. This makes it simple to test performance changes of pull requests by comparing the speed before and after the change. To make sure it runs in a reasonable time it covers the main feature set not all code.

Example Benchmark Output:


(.venv) hugo@Mac DeerLab % pytest benchmarks       
======================================================================================================================================================================== test session starts ========================================================================================================================================================================
platform darwin -- Python 3.14.4, pytest-9.0.3, pluggy-1.6.0
benchmark: 5.3.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/hugo/Documents/Work/GitHub/DeerLab/benchmarks
configfile: pytest.ini
plugins: benchmark-5.3.1
collected 9 items                                                                                                                                                                                                                                                                                                                                                   

benchmarks/bench_bootstrap.py ..                                                                                                                                                                                                                                                                                                                              [ 22%]
benchmarks/bench_fitting.py .......                                                                                                                                                                                                                                                                                                                           [100%]


------------------------------------------ benchmark 'bootstrap': 2 tests -----------------------------------------
Name (time in s)                      Min               Mean             Median            StdDev            Rounds
-------------------------------------------------------------------------------------------------------------------
test_4pdeer_bootstrap[1core]      10.7006 (2.41)     10.8263 (2.38)     10.7029 (2.36)     0.2158 (2.12)          3
test_4pdeer_bootstrap[4cores]      4.4434 (1.0)       4.5406 (1.0)       4.5322 (1.0)      0.1016 (1.0)           3
-------------------------------------------------------------------------------------------------------------------

-------------------------------------------------- benchmark 'fit': 7 tests -------------------------------------------------
Name (time in s)                                  Min              Mean            Median            StdDev            Rounds
-----------------------------------------------------------------------------------------------------------------------------
test_4pdeer_compactness                        5.3232 (11.18)    5.3352 (11.14)    5.3322 (11.17)    0.0097 (3.66)          5
test_4pdeer_global                             2.0096 (4.22)     2.0185 (4.21)     2.0150 (4.22)     0.0080 (3.04)          5
test_4pdeer_single_pathway                     0.5128 (1.08)     0.5159 (1.08)     0.5158 (1.08)     0.0026 (1.0)           5
test_4pdeer_single_pathway_long                0.6547 (1.38)     0.6586 (1.37)     0.6594 (1.38)     0.0030 (1.12)          5
test_4pdeer_single_pathway_long_parametric     0.6781 (1.42)     0.6867 (1.43)     0.6858 (1.44)     0.0066 (2.50)          5
test_4pdeer_single_pathway_qp                  0.4761 (1.0)      0.4790 (1.0)      0.4772 (1.0)      0.0034 (1.29)          5
test_5pdeer_multiple_pathways                  0.7271 (1.53)     0.7361 (1.54)     0.7307 (1.53)     0.0104 (3.94)          5
-----------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean
=========================================================================================================================================================== 9 passed, 3888 warnings in 125.16s (0:02:05) ============================================================================================================================================================

HKaras and others added 17 commits December 5, 2022 15:36
* Increase version number and update changelog (JeschkeLab#455)

* Bugfixes 4th sep (JeschkeLab#460)

* Fix normalisation in rice model

Closes JeschkeLab#459

* Remove three spin anaysis

Closes JeschkeLab#427

* Improved installation instructions

* Caution about difference in definition of cost function

Closes JeschkeLab#450

* Bump Version

* Bug for non linearly constrained problems

When a problem is not linearly constrained and not non-negative, the linear solver outputs a result class not the solution.

* Keeping changelog up-to date

* Fixing Sophgrid bug (JeschkeLab#464)

* Fixing Sophgrid bug

* Add unit test for sophgrid

* Update changelog.rst for new release (JeschkeLab#466)
* Fixing Sophgrid bug

* Add unit test for sophgrid

* Minor doc update

* Bump version Number

* Remove unnecessary doc files

* Update changelog
* Seperate Kinterpolator into its own function

Interpolation in Scipy is very slow, currently the same interpolation is being rerun for every calculation of the dipolarkernal. This is now cached to speed it up.

* Only run orientation selection on grid and integral based kernals

This hunk of code is not needed when fresnel integrals are used so does not need to be evaluated

* Update changelog
* Update for 3.12

* Updated workflows and changelog

* Upload to 3.12
* Update for 3.12

* Updated workflows and changelog

* Upload to 3.12

* Numpy 2.0 compatibility updates

* Update Changelog
* Update for 3.12

* Updated workflows and changelog

* Upload to 3.12

* Fix bug in regparam grid search

Regparam would never build the grid correctly. Now using grid or Brent is automatically determined from number of elements in the regparamrange.

* Add extra error messages

* Update changelog

* Updated Example

* Updated test

The test has been updated. The previous convergence criteria was unreliable and only worked based on a coincidence.

* Prepare For Release

* Remove duplicate python version
@HKaras HKaras added this to the V1.3 milestone Dec 3, 2026
@HKaras HKaras self-assigned this Dec 3, 2026
@HKaras
HKaras requested a review from stestoll December 3, 2026 11:06
@HKaras
HKaras merged commit 9cb5098 into JeschkeLab:main Dec 3, 2026
9 checks passed
@HKaras
HKaras deleted the Benchmark-Libary branch December 3, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants