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(vector): Update legacy vector to optimize nth operations on iterators #634

Merged
merged 3 commits into from
Nov 19, 2021

Conversation

austinabell
Copy link
Contributor

Related #626 The existing vector iterator is very unoptimized because the map iterator removes the nth implementation, meaning any pagination will iterate all elements. This led us to recommend ugly patterns such as https://www.near-sdk.io/contract-structure/collections#pagination-with-persistent-collections when you should have been able to just use iterators with skip and take.

Since this Vector is used in legacy Unordered collections, I think this is a high leverage change, which is completely backwards compatible. Considering even backporting this as a patch version to the v3 so it doesn't require an upgrade to use it.

Just to be clear, this is not a problem with the store::Vector, just this legacy one.

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.

2 participants