brainglobe / BrainGlobe

General information, resources and dicussions for the BrainGlobe project.
https://brainglobe.info/
10 stars 1 forks source link

A suite of benchmarking tests for BrainGlobe #21

Open alessandrofelder opened 1 year ago

alessandrofelder commented 1 year ago

A key requirement for all BrainGlobe tools is that they can reasonably (say hours - 1 day) on PhD student laptops, to make the tools accessible for everyone. It is therefore important that we ensure that future changes to the code don't cause significant performance loss (especially considering https://github.com/brainglobe/cellfinder-core/issues/170 !)

Ultimately, we'd therefore like to have a suite of benchmarks that form part of the tests of all maintained BrainGlobe packages. A preliminary discussion in a developer meeting suggests airspeed-velocity/asv as a useful tool to achieve this (but this is not set-in-stone).

A naive, initial approach might be:

Resources

Profiling tools that have come in handy before and may help understand what to benchmark/deepen general understanding of our code performance are

adamltyson commented 1 year ago

Just to flesh this out, I would say the ideal case initially would be to have:

For cellfinder-core

For brainreg

All of these jobs should fail if run time or peak memory usage exceeds 10% (?) of some baseline (TBC).

Stretch goals

What do you think @alessandrofelder?

adamltyson commented 1 year ago

FYI - #23

If there's lots of shared benchmarking code it could live in bg-benchmarking, if there isn't much it could be bg-utils.benchmarking, perhaps with non runtime dependencies downloaded with pip install bg-utils[benchmarking]?

adamltyson commented 1 year ago

@sfmig one idea that isn't in this issue is to look at the timings from the original brainreg and cellfinder papers. The machines used to generate these benchmarks are still available, and we can run both the version released with the paper and the most recent to get a performance baseline.

sfmig commented 1 year ago

Some thoughts on benchmarking tools

After a bit of research I'd highlight these two:

Asv

Pyperf

Other comments

Suggested next steps

sfmig commented 1 year ago

Profiling tools

We'd like to use profilers to identify bottlenecks, to narrow down what we need to benchmark. From having a look at the suggested tools here and in the top comment of the thread:

alessandrofelder commented 1 year ago

https://github.com/brainglobe/cellfinder-core/pull/184/files#r1269597227 so we don't forget that we'd like/expect the benchmarking instructions to become more BG-specific in the future.