Becksteinlab / kda

Python package used for the analysis of biochemical kinetic diagrams.
GNU General Public License v3.0
5 stars 1 forks source link

BENCH: Add cycle flux benchmark #114

Closed nawtrey closed 3 months ago

nawtrey commented 3 months ago

Description

I'm adding a benchmark for calc_net_cycle_flux since future changes will likely affect its performance, and it would be good to know how well (or poorly) it is performing beforehand.

Here are the results of the new benchmarks from a local run:

$ asv run -b CycleFlux*
Couldn't load asv.plugins._mamba_helpers because
No module named 'libmambapy'
▒ Creating environments
▒ Discovering benchmarks
▒▒ Uninstalling from conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒▒ Building 5349eb49 <add_cycle_flux_bench> for conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒▒ Installing 5349eb49 <add_cycle_flux_bench> into conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
▒ Running 2 total benchmarks (1 commits * 1 environments * 2 benchmarks)
[ 0.00%] ▒ For kda commit 5349eb49 <add_cycle_flux_bench>:
[ 0.00%] ▒▒ Benchmarking conda-py3.9-pip+networkx-pip+numpy-pip+pytest-pip+sympy
[50.00%] ▒▒▒ Running (bench_calculations.CycleFlux.time_calc_net_cycle_flux--).
[75.00%] ▒▒▒ ...ations.CycleFlux.peakmem_calc_net_cycle_flux                ok
[75.00%] ▒▒▒ ============== ======= =======
             --              output_strings
             -------------- ---------------
                 graph        True   False
             ============== ======= =======
                3-state      73.3M   72.2M
              Hill-5-state   74.9M   72.6M
              Hill-8-state   83.2M   72.7M
             ============== ======= =======

[100.00%] ▒▒▒ ...culations.CycleFlux.time_calc_net_cycle_flux                ok
[100.00%] ▒▒▒ ============== ============= =============
              --                    output_strings
              -------------- ---------------------------
                  graph           True         False
              ============== ============= =============
                 3-state      1.80~0.01ms     756~30us
               Hill-5-state    22.6▒0.2ms   7.52▒0.05ms
               Hill-8-state    8.07▒0.02s    70.7▒0.8ms
              ============== ============= =============

I'll just note that I chose not to add the EmrE-8-state model here because it 1.) results in a RecursionError and 2.) takes absolutely forever. The Hill 8-state model is already plenty complex to capture the [lack of] performance here, so I didn't think it was worth the hassle.

Changes

nawtrey commented 3 months ago

I'll just mention #108 here since it is arguably related.

This doesn't affect any tests or other CI things, and runs locally. Merging.