[ENH]: Addition of initial ASV benchmarking suite with synthetic data - #503
KaranSinghDev wants to merge 5 commits into
Conversation
780ec18 to
6ef3213
Compare
|
Hi @KaranSinghDev, thanks for putting this ASV infrastructure together! I’m focusing on heavily optimizing pyGAM's matrix operations, and having this automated suite in place is exactly what the project needs to safely track mathematical performance regressions. I was looking through your benchmarks/ directory setup, and it looks incredibly clean. I've been locally profiling a severe O(N^3) memory bottleneck in the Effective Degrees of Freedom (EDoF) calculation (np.diagonal(U1.dot(U1.T))) for overparameterized datasets (p > n). I have a vectorized O(N) fix ready, but we desperately need a baseline in ASV to permanently prove the memory reduction. Here is a snapshot of the memory profile I ran locally, showing the ~760 MiB spike on the legacy calculation versus the near-zero allocation of the vectorized approach: Generating synthetic U1 matrix with shape (10000, 500)... --- Running Legacy Calculation --- --- Running Optimized Calculation --- I’d love to translate my profiling scripts into an EDoFBenchmark ASV class and contribute them directly to your suite. Would you be open to me opening a PR directly against your karan-asv-branch to add this? That way, we can get your infrastructure and the first major memory stress-test merged together as a complete package! Let me know what you think. |
|
This contribution looks very cool! |
…DoF bottleneck tests
…DoF bottleneck tests
f15deb8 to
b058c70
Compare
|
@dswah I've updated the PR with the GitHub Actions workflow. I also merged and refactored @hritikkumarpradhan's EDoF benchmark. I ensured the matrix dimensions are locked as constants and added a random seed for stability. Profiling locally confirmed it safely isolates the O(N^3) bottleneck (~800MB spike) without exceeding the 7GB memory limit of the GitHub runners. As implementation, the files made and what they do : 2.
4. Let me know your thoughts on this . P.S. Regarding the changes such as individual profiling of components, imporving dashbaord etc. I was thinking of making a new PR and not adding them in it to keep it easy to understand this PR and its work |
|
Thanks @KaranSinghDev for the clean integration! Agreed on keeping this PR focused — the CI workflow + benchmarks are already a solid, self-contained addition. |
Fixes #471
This PR implements a formal benchmarking infrastructure using Airspeed Velocity (asv). This fulfills the long-standing request mentioned in #99 to provide a mechanism for tracking performance history and preventing speed regressions.
Implementation
asv.conf.jsonconfigured for isolated virtualenv builds and directpipinstallation for cross-platform stability.numpyto avoid dependencies onpandasor external CSV files and ensures we measure algorithmic throughput rather than disk I/O speed.OMP_NUM_THREADS=1andMKL_NUM_THREADS=1to ensure timing remains consistent across different hardware configurations.LinearGAMFit: Measures fitting, prediction, and gridsearch latency.PoissonGAMFit: Benchmarks the performance of the iterative PIRLS loop using a stable mathematical signal to ensure rapid convergence and prevent timeouts.Verification
I have thoroughly verified in an isolated environment. All benchmarks execute in under 300ms, ensuring the suite is fast enough for CI/CD integration.
Sample Local Output:
The tests have been done on Python 3.10/3/13. Linux (Ubuntu), with CPU: i7 12700h.