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

Change Amt::for_each_mut to ignore unchanged values #749

Merged
merged 2 commits into from
Oct 16, 2020

Conversation

timvermeulen
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

Adds an amt::ValueMut wrapper type that wraps a mutable reference to an element in the Amt and keeps track of whether it was mutated, to avoid flushing nodes later that weren't changed in the first place.

Also updates the BitFieldQueue to correctly only write a value back conditionally.

Reference issue to close (if applicable)

Closes #736

Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

Great use of the guard pattern! This seems generally correct, but I am definitely a bit worried about matching their caching for this. Checking the go implementation it seems like they aren't caching nodes through for_each on the Amt.

Anyways, that can be tackled and tested later, this should be good for now

@austinabell
Copy link
Contributor

I'm pretty sure that for the exact usage there will still be a difference in blockstore interactions from the go implementation, but I guess this can be iteratively fixed. Would have been nice to add or modify a test to check this use

@timvermeulen timvermeulen merged commit 6a46d7a into main Oct 16, 2020
@timvermeulen timvermeulen deleted the tim/amt-for-each-mut-fix branch October 16, 2020 07:16
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.

Change Amt::for_each_mut to ignore unchanged values
3 participants