perf(services): gate service-desc rebuild on data_version (PERF-4)#618
Merged
Conversation
_async_update_service_descriptions ran on every coordinator listener fire and, BEFORE its short-circuit, hydrated every child/chore/reward/ penalty/bonus/group from its dict and repr()-ed the lot as a change fingerprint. The dynamic selectors only change via a save (which bumps storage.data_version), so use that O(1) counter as the fingerprint and short-circuit before any hydration. Entities are built only when the version actually changed. Tests: rebuild skipped when version unchanged; rebuilt after a bump.
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.
PERF-4 — Cheaper service-description fingerprint
_async_update_service_descriptionsfires on every coordinator listener update. Before its short-circuit it hydrated every child/chore/reward/penalty/bonus/group from its stored dict andrepr()-ed the whole option set as the change fingerprint — on every fire, even when nothing relevant changed.Fix
The dynamic selectors mirror those collections, which only change via a save (bumping
storage.data_version, added in PERF-2). Use that O(1) counter as the fingerprint and short-circuit before any hydration; build the option lists only when the version actually changed. Conservative: it never misses a real change (every entity mutation saves), at worst it rebuilds on an unrelated save.Verification
test_service_desc_fingerprint.py: hydration skipped when version unchanged; runs again after a bump. Ruff clean.Part of the v4.3.1 audit fix campaign. No version bump / release.