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

Use atree readonly iterators when mutation of values is not needed #3170

Conversation

fxamacker
Copy link
Member

Closes #2836

Atree readonly iterators are more performant than non-readonly iterators. This PR uses readonly iterators when feasible to prevent performance regression.


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@fxamacker fxamacker added Improvement Performance E&V Team Execution / Verification / Edge Team labels Mar 13, 2024
@fxamacker fxamacker self-assigned this Mar 13, 2024
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

How does this compare to the v0.42 branch/variant?

runtime/interpreter/value.go Outdated Show resolved Hide resolved
runtime/interpreter/value.go Outdated Show resolved Hide resolved
Currently, we are not sure if all uses can be guaranteed to
be readonly in two functions, so this commit uses atree
non-readonly iterators in:
- CompositeValue.ForEachFieldName
- DictionaryValue.IterateKeys

Also added TODO to determine if all uses can be guaranteed to be
readonly for these, which would allow us to revert this change.
@fxamacker fxamacker force-pushed the fxamacker/use-atree-readonly-iterators branch from 8edcf7e to b68900d Compare April 4, 2024 14:44
@fxamacker fxamacker requested a review from turbolent April 4, 2024 14:48
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E&V Team Execution / Verification / Edge Team Improvement Performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants