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

fix(compiler): remove createMapIterator in some places #2413

Merged
merged 2 commits into from
Jun 1, 2021

Conversation

spencercorwin
Copy link
Collaborator

Description of the Change

  • Replace any new empty array creations with NEWARRAY0 instead of pushing 0 and then calling NEWARRAY
  • Try to replace the use of iterators (ones created with createMapIterator helper) everywhere. Usually by using a new reduce helper or a forLoop helper.
  • Update compiler test block.test.ts

Test Plan

Various array and map builtin compiler tests.

Alternate Designs

None.

Benefits

Removes the use of very expensive and non-constant storage iterators which were/are being created with createMapIterator helper. That helper was created as a work-around to the removal of the iterator APIs from the VM. But it turned out that this was not a great solution since it modified contract storage, causing nearly all contract methods to use storage (and thus not be "constant" methods) and caused contract call prices to go way up.

Possible Drawbacks

None.

Applicable Issues

#2410

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.

1 participant