feat: Optimize set_property if dependent does not need partial change-event processing#844
Open
RobertJacobsonCDC wants to merge 2 commits intomainfrom
Open
feat: Optimize set_property if dependent does not need partial change-event processing#844RobertJacobsonCDC wants to merge 2 commits intomainfrom
set_property if dependent does not need partial change-event processing#844RobertJacobsonCDC wants to merge 2 commits intomainfrom
Conversation
Benchmark ResultsHyperfine
CriterionRegressions (slower)
Improvements (faster)
Unchanged / inconclusive (CI crosses 0%)
|
k88hudson-cfa
approved these changes
Apr 15, 2026
Collaborator
k88hudson-cfa
left a comment
There was a problem hiding this comment.
Nice! Looks good to me. Thanks for adding the benchmark
| context.set_property(black_box(person), MixedBaseValue(black_box(value))); | ||
| } | ||
| }, | ||
| BatchSize::SmallInput, |
Collaborator
There was a problem hiding this comment.
What's the reason for SmallInput?
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.
This PR makes
set_propertyfaster when property-change machinery is not actually needed.Previously,
set_propertyalways createdPartialPropertyChangeEvents for the property being written and for every derived dependent. These hold the previous value of their respective properties so that property change events can be emitted and indexes and value change counters updated. This PR adds a cheap per-property check and does not create partial change events for properties that have noPropertyChangeEventsubscribers, no value-change counters, and no indexes to maintain.To support that, the change adds:
Contextto check whether a given event type has any registered handlers;set_propertyfast path that skips partial-event creation for unaffected properties.The benchmarks were also expanded with a steady-state mixed benchmark that keeps one
Contextalive, flushes callbacks between measured chunks, and exercises the three relevant cases at once: indexed dependent, counted dependent, and handler-backed dependent. That gives us a way to measure both the new best case and the pessimistic path without distorting results with unbounded callback queue growth.Local Benchmarks
Local Criterion benchmarks in the
ixarepo:The improvement in the last case is spurious: that's the "control" in which we actually can't avoid doing the work. The fact that it isn't a regression, though, is good, because that says that the extra checking this optimization requires is negligible.
The result of a few runs of
ixa-epi-covid's comparison benchmarks (make bench-compare) on my local machine: