Skip to content

Add static arrays performance example - #193

Merged
THargreaves merged 1 commit into
mainfrom
th/static-arrays-example
Sep 28, 2026
Merged

THargreaves merged 1 commit into
mainfrom
th/static-arrays-example

Conversation

@THargreaves

Copy link
Copy Markdown
Collaborator

Closes #45.

Adds a Literate example (GeneralisedFilters/examples/static-arrays) comparing Array and SArray models for the Kalman filter, bootstrap filter and RBPF on a constant-velocity tracking model.

  • 4-D state: all three filters are ~10× faster with static arrays; the static Kalman filter is allocation-free.
  • Dimension sweep (D = 2–32): speed-up curves for all three filters on one plot. The benefit falls with dimension (Kalman 20× → 1.2×, bootstrap 15× → 1.0×), while the RBPF keeps ~3× at D = 32. The drop-off is linked to StaticArrays' size cut-offs (14×14 for LU/solve/inv, 24×24 for Cholesky).
  • Explains how mixing in ordinary arrays promotes states back to Arrays, and how to check the filtered state's type.
  • Briefly covers per-dimension compilation cost.

Benchmarks are precomputed in results.csv so the docs build stays fast; regenerate with REGENERATE_BENCHMARKS=true julia --project script.jl. Also links the example from the README and docs pages.

Benchmarks the Kalman filter, bootstrap filter and RBPF with Array and
SArray models across state dimensions, using precomputed results so the
docs build stays fast. Links the example from the README and docs.

Closes #45
@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.88%. Comparing base (3fd71e5) to head (b6cc3f9).

Files with missing lines Patch % Lines
...eneralisedFilters/examples/static-arrays/script.jl 0.00% 40 Missing ⚠️
...eralisedFilters/examples/static-arrays/plotting.jl 0.00% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #193      +/-   ##
==========================================
- Coverage   80.28%   78.88%   -1.40%     
==========================================
  Files          75       77       +2     
  Lines        3327     3386      +59     
==========================================
  Hits         2671     2671              
- Misses        656      715      +59     
Flag Coverage Δ
GeneralisedFilters 79.67% <0.00%> (-1.47%) ⬇️
SSMProblems 56.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@THargreaves
THargreaves merged commit 7fba2b9 into main Sep 28, 2026
16 of 18 checks passed
@THargreaves
THargreaves deleted the th/static-arrays-example branch September 28, 2026 09:12
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.

Create an example using static arrays

1 participant