Skip to content

Add allocation tests to prevent performance regressions#101

Merged
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:perf-improvements-20260112-065151
Jan 12, 2026
Merged

Add allocation tests to prevent performance regressions#101
ChrisRackauckas merged 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:perf-improvements-20260112-065151

Conversation

@ChrisRackauckas-Claude
Copy link
Contributor

Summary

This PR adds allocation tests to the SimpleDiffEq.jl test suite to prevent performance regressions. After thorough profiling and benchmarking of the package, the core solvers were found to be already well-optimized with zero allocations for step! functions.

Benchmarking Results

All solvers showed zero allocations for their step! functions:

Solver OOP (SVector) IIP (Vector)
SimpleTsit5 ~64 ns, 0 allocs ~109 ns, 0 allocs
SimpleRK4 ~31 ns, 0 allocs ~77 ns, 0 allocs
SimpleEuler ~13 ns, 0 allocs ~22 ns, 0 allocs
SimpleATsit5 0 allocs per step 0 allocs per step

Changes

  • New file: test/alloc_tests.jl: Tests that verify zero allocations for all core solver step! functions (SimpleTsit5, SimpleRK4, SimpleEuler, SimpleATsit5) in both out-of-place (OOP with SVector) and in-place (IIP with Vector) formulations.

  • Modified: test/runtests.jl: Added allocation tests to the "nopre" CI group alongside JET static analysis tests.

Test Plan

  • Ran allocation tests locally - all pass with 0 allocations
  • Ran JET tests locally - all pass
  • Ran Core test suite locally - all pass

cc @ChrisRackauckas

🤖 Generated with Claude Code

This adds a new test file `test/alloc_tests.jl` that verifies zero
allocations for all core solver step functions. The tests verify:

- SimpleTsit5 step! (OOP and IIP)
- SimpleRK4 step! (OOP and IIP)
- SimpleEuler step! (OOP and IIP)
- SimpleATsit5 step! (OOP and IIP)

The tests use @allocated to verify zero heap allocations at runtime,
ensuring the high-performance characteristics of these solvers are
maintained. The tests are included in the "nopre" CI group alongside
the existing JET static analysis tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 871fc9b into SciML:master Jan 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants