[ENH] Implement automated benchmarking suite
Currently, there is robust test suite for functional correctness, but it lacks a formal system to track performance regressions or validate speed-related enhancements based on speed related concerns such as #406 and #190 . While adding benchmarks was originally suggested in issue #99, there is still no automated way to monitor the execution speed of core methods like .fit() across different commits.
I think implementing a benchmarking suite could be useful (like ASV) This would automatically track performance history and generate graphs, providing an objective way to review speed-focused contributions without affecting the core mathematical logic.
Based on my understanding and working , such infrastructure does not exists in the current codebase and would like to work the initial setup and benchmark scripts if it is not being worked upon maintainers .Let me know your thoughts on this @ankurankan @dswah
Hi, I analyzed the repository and confirmed that no automated benchmarking infrastructure currently exists.
Since the codebase has performance-critical paths (e.g., _pirls, _modelmat, gridsearch()), benchmarking would be useful to detect regressions. However, a full ASV setup might be heavier than necessary given the project’s current development velocity.
As a first step, I propose adding a few pytest-benchmark tests for key methods such as fit(), predict(), and gridsearch(). This would integrate directly into the existing test suite and provide immediate performance tracking with minimal infrastructure.
If that approach sounds reasonable, I’d be happy to open a PR implementing these initial benchmarks.
@Karman580 I agree while pytest-benchmark is great for local snapshots, I think asv is the better fit for this case because it natively tracks performance history across Git commits and generates visual dashboards without complex CI/caching which may overcome the de merit of it. Let me know your thoughts on this I have already drafted the asv.conf.json and initial benchmark scripts locally, I will open the PR shortly . I would appreciate your review on the benchmark logic.
Thanks for the clarification , that makes sense. ASV would indeed provide better long-term visibility since it tracks performance across commits and generates historical benchmarks automatically. If you’re already preparing the asv.conf.json and the initial benchmark suite, that sounds like a solid direction. I’d be happy to review the benchmark design once you open the PR, especially around the choice of benchmark cases (e.g., fit(), predict(), and gridsearch() on representative dataset sizes) to ensure they reflect realistic workloads. Looking forward to the PR.
Hi @dswah @ankurankan
I've opened a PR directly against Karan's ASV branch here: https://github.com/KaranSinghDev/pyGAM/pull/1 adding the EDoFBenchmark class. Looking forward to seeing this suite merged!