Repository navigation
Record whether an array has been optimized - #11089
Merged
Merged
Conversation
This was referenced Nov 2, 2026
robert3005
marked this pull request as ready for review
November 2, 2026 12:06
Merging this PR will degrade performance by 0.83%1 warning
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Each array now has an OptimizedState. optimize_recursive marks every node it returns, so it returns a marked array again without trying any rule. optimize and optimize_ctx also return a marked array as it is. Arrays decoded from their serialized form are marked as optimized. Changing a uniquely owned array in place clears the mark. Signed-off-by: Robert Kruszewski <github@robertk.io>
OptimizedState::clear had a single caller. inner_mut now resets the AtomicBool through get_mut, which is pub(crate). Signed-off-by: Robert Kruszewski <github@robertk.io>
robert3005
force-pushed
the
rk/optimized-state
branch
from
November 2, 2026 12:20
146d015 to
23eb3ca
Compare
The optimized mark promises only that no rule applies given the encodings, dtypes, slots and data of the subtree, which do not change while the array is shared. Document the cases where an array must stay unmarked or clear its mark: an in-place change, a rule that reads state set after the pass such as statistics, and a session with more kernels. Also document why Relaxed ordering is correct, and when the flag needs Release and Acquire. Signed-off-by: Robert Kruszewski <github@robertk.io>
joseph-isaacs
approved these changes
Nov 2, 2026
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.
Summary
Part 1 of 4 of a split of #10793. The stack: #11089 → #11090 → #11091 → #11092.
The optimizer now records which arrays it has already optimized, so it does not try the rules on them again.
Changes
OptimizedState. A new array starts unoptimized.optimize_recursivemarks every node that it returns.optimize,optimize_ctxandoptimize_recursivereturn a marked array without trying any rule.SerializedArray::decodemarks every node that it decodes. Thus arrays that the file, IPC and plan v2 readers read are not optimized again.ArrayRef::inner_mutclears the mark, because the caller can change the array.