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

Memoize flattened property lookup #31494

Merged
merged 2 commits into from
Aug 17, 2023
Merged

Conversation

ajcvickers
Copy link
Contributor

@ajcvickers ajcvickers requested a review from a team August 17, 2023 15:52
@ajcvickers
Copy link
Contributor Author

/cc @danmoseley

@danmoseley
Copy link
Member

OK, if in your judgement risk is low.

/// Returns all <see cref="IProperty"/> members from this type and all nested complex types, if any.
/// </summary>
/// <returns>The properties.</returns>
public virtual IEnumerable<Property> GetFlattenedProperties()
Copy link
Member

@roji roji Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be public given that they're supposed to be memoized? Or are we doing memoization only for the runtime types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean. They aren't memoized for non runtime properties (because the types returned can change). But even if they were, why does being memoized mean they should be non-public?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't memoized for non runtime properties (because the types returned can change).

Right, makes sense.

But even if they were, why does being memoized mean they should be non-public?

I just meant that where we memoize, we shouldn't provide public access to the logic that does the costly calculation, bypassing the memoization. All seems ok.

Copy link
Contributor Author

@ajcvickers ajcvickers Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check with @andriipatsula @AndriySvyryd on this. I think I followed the existing pattern on this.

Copy link
Member

@AndriySvyryd AndriySvyryd Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine. Costly methods won't be available once the model is finalized.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with simplification/memoization remarks below

@ajcvickers ajcvickers merged commit 22b984a into release/8.0-rc1 Aug 17, 2023
@ajcvickers ajcvickers deleted the 230817_ApePancakes branch August 17, 2023 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants