Skip to content

perf: don't allocate in the inline linear SCC cache lookup - #169

Open
AJ0070 wants to merge 1 commit into
JuliaComputing:mainfrom
AJ0070:perf/inline-scc-tls-key
Open

AJ0070 wants to merge 1 commit into
JuliaComputing:mainfrom
AJ0070:perf/inline-scc-tls-key

Conversation

@AJ0070

@AJ0070 AJ0070 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

The task local storage key (INLINE_LINSOLVE_CACHE, typeof(A), size(A)) got boxed on every lookup, one 48 B allocation per inline linear SCC solve. The caches now sit in one typed Dict under the Symbol key, so the lookup doesn't allocate. Building a missing cache is moved out of line, since inlined it costs every solve ~25 ns on Julia 1.13 and eats the gain.

One allocation less per solve, also under ForwardDiff: the allocation test's RHS call goes from 128 to 80 B (112 to 64 B on 1.10). The lookup takes 19 ns instead of 39, and a model with three blocks 310 ns instead of 380. The test bound is now 256, which leaves room for #168's result array, and the lookup itself is checked to allocate nothing.

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.

1 participant