neo-one
neo-one copied to clipboard
Remove `CreateMapIteratorHelper` and all uses from compiler
They removed iterators except for storage iterators from VM. We used those iterators extensively in our compiler. So I created CreateMapIteratorHelper
to turn map stack items into storage iterators so that we could continue to iterator through these collections in our compiler. But this had the unforeseen consequence of using contract storage in virtually every method, and making our contracts extremely expensive. So I started to instead use for-loops in place of the new iterator helper. But there are more places where this needs to be done. Just search for helpers.createMapIterator
and get to work.
See #2412 for how and why the CreateMapIterator helper was created. Then see the problem that this created in the description of #2413. #2413 began the process of removing this helper from use in the compiler, but this needs to be finished to increase the user friendliness and reduce the cost of contracts from our compiler.
From duplicate issue #2414
- Finish removing iterators (besides storage) from compiler
* Could create an iterator/enumerator abstraction?
* Object: size, currentIndex, next, keysArr (not if enumerator), valuesArr
- ArrSomeHelper
- entries
- ArrayIterator
- map.forEach
- MapIterator
- set.forEach
- SetIterator
- ArrEveryHelper
- ArrFilterHelper
- ArrFindHelper
- ArrForEachHelper
- Have map foreach helper without iterator
- Replace all
- ArrReduceHelper
- Can use ArrReduceWithoutIterator
- Replace all
- ArrSomeFuncHelper
- ArrSomeHelper
- ArrayBindingHelper
- MapEveryHelper
- MapFilterHelper
- MapForEachHelper
- Replace all with MapForEachWithoutIterator
- MapReduceHelper
- Replace with without iterator
- MapSomeHelper
- ForOfStatementCompiler