-
Notifications
You must be signed in to change notification settings - Fork 334
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
Implement skip for ExternalIterator #1725
Comments
Huh, you want to override the trait method on the Rust side. Is this called somewhere? (We use limit a lot of places, but I don't think that calls skip. What composition would call this?) Also seems they recommend overriding |
You need this when doing iteration with offsets (pagination). Right now it just calls |
Oh, who uses pagination with numeric offsets? That is always terribly inefficient. Proper way is to provide some cursor like Not saying we can't do this, but it is covering up a problematic design... and they will still call the IAVL tree all those times, with 1000+ gas for every value they skip, even if this doesn't cause contract overhead. |
Yeah I know, I know. It was just the first example that popped up in my mind. I'll come up with a better use case ... |
This is implemented in #1838. However, Ethan is right and we should be careful when this is actually used. It indicates a bad storage layout. |
Right now skipping elements decodes the result region which we don't need as the value is dropped. We can just do
instead.
This improvement alone is not a game changer but in a follow-up step we can then add a
db_skip(self.iterator_id)
low import that does not write key and value to Wasm at all.The text was updated successfully, but these errors were encountered: