Skip to content

Collection update_if_needed reform #2 #4891

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

Merged
merged 6 commits into from
Sep 20, 2021
Merged

Collection update_if_needed reform #2 #4891

merged 6 commits into from
Sep 20, 2021

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented Sep 3, 2021

What, How & Why?

This is a port of #4726 to current master. More information can be found in that PR.

☑️ ToDos

  • 📝 Changelog update not relevant
  • 🚦 Tests (or not relevant)

@jedelbo jedelbo requested review from simonask and ironage September 3, 2021 13:19
@jedelbo
Copy link
Contributor Author

jedelbo commented Sep 3, 2021

@ironage perhaps you could have an initial look at this. I don't consider it finished as I think there are some performance issues that can be fixed. The port is not a 1-1 implementation as quite a few things have changed since then, but I have tried to be loyal to the spirit in the original PR. Lets discuss the general idea at some point.

@ironage
Copy link
Contributor

ironage commented Sep 3, 2021

I like this direction because it allows for more lazy loading and potentially better performance. I also think it reads better. If I had one wish, it would be to add some asserts that the accessor is not out of date in case we forget to update something. But forgetting to update an accessor is the notorious problem we already have so there's nothing new there.

@jedelbo jedelbo force-pushed the je/collection-update branch from fbc5b5d to 2c13bf0 Compare September 17, 2021 09:39
@jedelbo
Copy link
Contributor Author

jedelbo commented Sep 17, 2021

@ironage I consider this ready for review.

@jedelbo jedelbo removed the request for review from simonask September 17, 2021 09:40
@jedelbo jedelbo force-pushed the je/collection-update branch from 2c13bf0 to 396ed7a Compare September 17, 2021 09:42
Copy link
Contributor

@ironage ironage left a comment

Choose a reason for hiding this comment

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

LGTM, let's get this in 👍

@@ -336,7 +334,7 @@ bool Dictionary::is_null(size_t ndx) const

Mixed Dictionary::get_any(size_t ndx) const
{
update_if_needed();
// Note: `size()` calls `update_if_needed()`.
Copy link
Contributor

@bmunkholm bmunkholm Sep 20, 2021

Choose a reason for hiding this comment

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

@jedelbo Isn't that a quite unexpected side-effect judging from the name? Should it perhaps be renamed? It clearly was unexpected even from the implementers judging from the fixes from where this was called ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bmunkholm I am not sure I understand this comment. It should not be unexpected that size() calls update_if_needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

It just looked like that since the callsites calling size() called update_if_needed() before calling size() :-)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants