Add CodSpeed continuous benchmarking - #19
Merged
Merged
Conversation
Contributor
Author
Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This sets up continuous performance measurement for
pymathwith CodSpeed.What was added
Benchmark harness (divan via
codspeed-divan-compat)codspeed-divan-compatis added as a dev-dependency renamed todivan, so the benchmarks are plain divan benchmarks: they run standalone locally and are instrumented automatically when executed through CodSpeed.Three benchmark suites in
benches/:math.rs— real-valued functions, grouped by source module:trigonometric:sin,cos,tan,asin,acos,atan,atan2,sinh,cosh,tanh,asinh,acosh,atanhexponential:exp,exp2,expm1,log(natural and with an explicit base),log2,log10,log1p,sqrt,cbrt,powgamma:erf,erfc(including the|x| > 1.5continued-fraction branch),gammafor positive and negative arguments,lgammamisc:fabs,floor/ceil/trunc,frexp/modf,fmod,remainder,fma,nextafterwith steps,ldexp/ulp,iscloseaggregate:fsum,dist,sumprod,sumprod_int,prodat 8 / 128 / 4096 elements to cover both the short and long reduction pathscmath.rs— complex functions (exp,log,log10,sqrt, the six trigonometric and six hyperbolic functions plus their inverses,abs/phase,polar/rect) over a spiral of inputs spanning all four quadrantsinteger.rs— big-integer functions (factorial,comb,perm,isqrt,gcd,lcm,log_bigint) at several magnitudes, gated behindrequired-features = ["num-bigint"]Each scalar benchmark sweeps a fixed set of representative finite inputs inside the measured closure, so results reflect the function under test rather than harness overhead, and the input domains are chosen to stay in the valid range of each function.
CI workflow —
.github/workflows/codspeed.ymlruns the benchmarks in CPU simulation mode onubuntu-latest(same runner as the existing Rust workflow), on pushes tomain, on pull requests, and onworkflow_dispatchso CodSpeed can backfill baseline data. It authenticates with OIDC (id-token: write), builds withcargo codspeed build --features num-bigintso all three suites are included, and Python is set up because the crate's dev-dependencies includepyo3withauto-initialize.README — added the CodSpeed badge.
Validation
All three suites were built and executed locally with
codspeed run --mode simulation -- cargo codspeed run; the full set of benchmarks completed and reported results.cargo clippy --benches --features num-bigintandcargo fmtare clean.Next steps
mainrun establishes the performance baseline.benches/.