Conversation
- apply_meta! walked every node of the model for every meta entry, and kept those in the context: quadratic in the model's size with @meta or @Algorithm. It walks the context's own factor nodes. - Resolving a constraint on a matrix variable summed the lengths of every slice before an index for each element, quadratic in the variable's size. While constraints are applied, the plugin binds a cache of those prefix sums per array (with_flattened_index_cache, cached_flattened_index). - NodeLabel == compares the counter first, an Int unique per node, before the untyped name. - The factorisation bitsets start as the full joint, built directly, and a node with no factorisation at all skips the partition step. - ConstraintStack keeps its constraints in a Vector read from the top, where DataStructures' Stack allocated a 1024-element block for every model; it gains length and eltype. Tests: cached_flattened_index against flattened_index on a ragged array, with and without the cache; ConstraintStack's order, counts and pops. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Re8DzeAcZpjeENCE44QJjF
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.9.0 #333 +/- ##
==========================================
+ Coverage 91.04% 91.28% +0.23%
==========================================
Files 16 16
Lines 2301 2318 +17
==========================================
+ Hits 2095 2116 +21
+ Misses 206 202 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
What
Five non-breaking fixes to model creation. The results are unchanged: the existing tests pass untouched.
apply_meta!walks the context's own factor nodes, not every node of the model filtered by membership in the contextplugins/meta/meta_engine.jl@algorithm: nonlinear SSM at n = 3 000, 4.51 → 0.47 sflattened_indexof a matrix variable uses prefix sums cached per array (with_flattened_index_cache,cached_flattened_index), bound aroundapply_constraints!resizable_array.jl,variational_constraints*.jlNodeLabel ==compares theIntcounter firstgraph_engine.jlvariational_constraints*.jlConstraintStackkeeps aVector, read from the top as theStackwasvariational_constraints_engine.jlDataStructures.Stackallocated a 1 024-element block per model: 12–29% of a tiny model'sinferThese were measured as part of ReactiveMP's end-of-refactor performance pass (Julia 1.13, M-series Mac). The cache uses
task_local_storageas a dynamic scope, sinceScopedValueis Base only from Julia 1.11 and GraphPPL supports 1.10.Tests
cached_flattened_indexagrees withflattened_indexon a ragged 3-D array, with and without the cache, and on a 1-D one;ConstraintStackreads from the top, keeps its per-context counts and pops per context (it gainslengthandeltype).make test: 76 878 pass, 1 broken as before.make lintalso reports 12 files on4.9.0itself, and formatting the touched files would rewrite unrelated code.🤖 Generated with Claude Code
https://claude.ai/code/session_01Re8DzeAcZpjeENCE44QJjF