Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF-1035] Track ComputedVar dependency per class #2067

Merged
merged 4 commits into from
Nov 28, 2023

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Oct 28, 2023

  • Move computed var tracking to subclass initialization -- no need to recalculate these every time an instance is created (and when using Redis, this can be for every request)
  • Move _always_dirty_computed_vars tracking to subclass initialization, again, not needed every time a delta is computed
  • Start tracking substates that have always dirty computed vars so they can be recursively recomputed whenever the state changes.
  • Use leading underscore for _computed_var_dependencies and _substate_var_dependencies to indicate they are private

Fix #2066

Additional testing is needed, as we should have had some tests that fail without this change.

There is no need to recompute these every time a state is initialized, which
can be basically for every request if we're using redis.
…ates

Instead of calculating these every time there is a delta, determine them
at subclass definition time (or when adding a var dynamically).

This should improve performance for every delta calculation.

It also fixes #2066 by tracking substates which have ComputedVar with
_cache=False

Fix REF-1035
@masenf masenf force-pushed the masenf/computed-var-tracking branch from af1b042 to 5d5e712 Compare November 22, 2023 06:05
@masenf masenf marked this pull request as ready for review November 22, 2023 06:15
@masenf masenf changed the title Track ComputedVar dependency per class [REF-1035] Track ComputedVar dependency per class Nov 22, 2023
@picklelo picklelo merged commit ee87e62 into main Nov 28, 2023
45 checks passed
@masenf masenf deleted the masenf/computed-var-tracking branch December 6, 2023 22:16
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.

[REF-1035] ComputedVar in substate is not recomputed
2 participants