Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add airspeed velocity benchmarks #109

Merged
merged 1 commit into from
Aug 14, 2024
Merged

Add airspeed velocity benchmarks #109

merged 1 commit into from
Aug 14, 2024

Conversation

nawtrey
Copy link
Collaborator

@nawtrey nawtrey commented Aug 14, 2024

Changes

  • Add asv configuration file

  • Add two benchmark files: bench_diagrams.py for benchmarking functions in diagrams.py and
    bench_calculations.py for benchmarking
    functions in calculations.py

  • Add requirements_dev.txt for easy installation of required packages for
    asv benchmarking and testing with
    pytest. Will eventually be used in CI.

  • Related to CI: Add Airspeed Velocity benchmarking to CI #108

Description

As discussed in #108, we are adding some benchmarks for easy performance comparison between commits.

To run the benchmarks locally, simply run asv run from the kda/benchmarks directory. Running on this commit gave me the following results:

Output for local run
$ asv run
Couldn't load asv.plugins._mamba_helpers because
No module named 'conda'
▒ Creating environments
▒ Discovering benchmarks
▒▒ Uninstalling from conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒▒ Building 254155f8 <issue_108_add_asv> for conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒▒ Installing 254155f8 <issue_108_add_asv> into conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒ Running 10 total benchmarks (1 commits * 1 environments * 10 benchmarks)
[ 0.00%] ▒ For kda commit 254155f8 <issue_108_add_asv>:
[ 0.00%] ▒▒ Benchmarking conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[10.00%] ▒▒▒ Running (bench_calculations.Sigma.time_calc_sigma--)..
[30.00%] ▒▒▒ Running (bench_diagrams.DirectionalDiagrams.time_generate_directional_diagrams--)...
[55.00%] ▒▒▒ bench_calculations.Sigma.peakmem_calc_sigma                    ok
[55.00%] ▒▒▒ ============== ======= =======
             --              output_strings
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      70.4M   70.3M
              Hill-5-state   70.4M    70M
              Hill-8-state   70.7M   70.9M
              EmrE-8-state   73.3M   73.4M
             ============== ======= =======

[60.00%] ▒▒▒ bench_calculations.Sigma.time_calc_sigma                       ok
[60.00%] ▒▒▒ ============== ============ ============
             --                   output_strings
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      73.6~20us     58.7~8us
              Hill-5-state   531~200us    552~100us
              Hill-8-state   6.68▒0.7ms   6.41▒0.3ms
              EmrE-8-state    40.8▒1ms    50.7▒10ms
             ============== ============ ============

[65.00%] ▒▒▒ ...ulations.StateProbs.peakmem_calc_state_probs                ok
[65.00%] ▒▒▒ ============== ======= =======
             --              output_strings
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      72.3M   70.5M
              Hill-5-state   72.4M   70.6M
              Hill-8-state    75M     71M
              EmrE-8-state    81M    73.3M
             ============== ======= =======

[70.00%] ▒▒▒ ...alculations.StateProbs.time_calc_state_probs                ok
[70.00%] ▒▒▒ ============== ============ ============
             --                   output_strings
             -------------- -------------------------
                 graph          True        False
             ============== ============ ============
                3-state      3.60▒0.9ms   1.43▒0.2ms
              Hill-5-state    14.9▒1ms    6.87▒0.4ms
              Hill-8-state    653▒40ms     63.3▒9ms
              EmrE-8-state   11.0▒0.1s     418▒20ms
             ============== ============ ============

[75.00%] ▒▒▒ ...agrams.peakmem_generate_directional_diagrams                ok
[75.00%] ▒▒▒ ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      70.2M   70.3M
              Hill-5-state   70.4M   70.8M
              Hill-8-state   70.8M   76.2M
              EmrE-8-state   73.4M    109M
             ============== ======= =======

[80.00%] ▒▒▒ ...lDiagrams.time_generate_directional_diagrams                ok
[80.00%] ▒▒▒ ============== ============= =============
             --                     return_edges
             -------------- ---------------------------
                 graph           True         False
             ============== ============= =============
                3-state      1.17▒0.01ms   1.52▒0.01ms
              Hill-5-state    6.29▒0.1ms   9.05▒0.05ms
              Hill-8-state    53.6▒0.5ms     89.2▒3ms
              EmrE-8-state     388▒30ms      684▒50ms
             ============== ============= =============

[85.00%] ▒▒▒ ....FluxDiagrams.peakmem_generate_flux_diagrams                ok
[85.00%] ▒▒▒ ============== =======
                 graph
             -------------- -------
                3-state      70.6M
              Hill-5-state   70.8M
              Hill-8-state   71.3M
              EmrE-8-state   76.5M
             ============== =======

[90.00%] ▒▒▒ ...ams.FluxDiagrams.time_generate_flux_diagrams                ok
[90.00%] ▒▒▒ ============== ============
                 graph
             -------------- ------------
                3-state       859~20us
              Hill-5-state   2.64▒0.6ms
              Hill-8-state    24.7▒4ms
              EmrE-8-state    157▒1ms
             ============== ============

[95.00%] ▒▒▒ ...alDiagrams.peakmem_generate_partial_diagrams                ok
[95.00%] ▒▒▒ ============== ======= =======
             --               return_edges
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      70.2M   70.3M
              Hill-5-state   70.2M   70.4M
              Hill-8-state   70.5M   70.8M
              EmrE-8-state   70.3M    73M
             ============== ======= =======

[100.00%] ▒▒▒ ...rtialDiagrams.time_generate_partial_diagrams                ok
[100.00%] ▒▒▒ ============== ============ =============
              --                    return_edges
              -------------- --------------------------
                  graph          True         False
              ============== ============ =============
                 3-state       246~8us       234~7us
               Hill-5-state    494~7us       469~2us
               Hill-8-state   3.00▒0.2ms   2.77▒0.06ms
               EmrE-8-state   17.7▒0.1ms     17.9▒2ms
              ============== ============ =============

The 10 benchmarks are parameterized over different graphs starting from the simple 3-state model to the 8-state EmrE model to give a reasonable range for comparison.

* Add `asv` configuration file

* Add two benchmark files: `bench_diagrams.py`
for benchmarking functions in `diagrams.py` and
`bench_calculations.py` for benchmarking
functions in `calculations.py`

* Add `requirements_dev.txt` for easy
installation of required packages for
`asv` benchmarking and testing with
`pytest`. Will eventually be used in CI.
@nawtrey
Copy link
Collaborator Author

nawtrey commented Aug 14, 2024

Alright, I think this is a healthy starting point for benchmarking KDA functions and all benchmarks are working as intended locally. Merging.

@nawtrey nawtrey merged commit e3505b1 into master Aug 14, 2024
6 checks passed
@nawtrey nawtrey deleted the issue_108_add_asv branch August 14, 2024 04:45
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.

1 participant