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

Add Lazy collection type #406

Closed
austinabell opened this issue May 5, 2021 · 1 comment
Closed

Add Lazy collection type #406

austinabell opened this issue May 5, 2021 · 1 comment

Comments

@austinabell
Copy link
Contributor

There is currently a LazyOption type, which behaves as an Option but it would be beneficial to just have a lazily loaded value where the assertion that a value is always stored is kept (stored on initialization and errors if not found) instead of leaving to developers to check/unwrap in code.

Side benefit of this (and lazy option) is to have the values and changes cached to avoid duplicate reads/writes to storage, similar to what is being explored with #402. This would be a good candidate for using oncecell @matklad might have thoughts as to if there is overhead that won't be acceptable in this context (there are some thread blocking components which I'm not sure how it fits into the wasm smart contract env) or re-using the cache primitive from #402.

This caching change can also be applied to LazyOption but likely all changes would live under the unstable flag.

cc @evgenykuzyakov as this was related to what I asked about in contract review

@austinabell
Copy link
Contributor Author

Closed with #409

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

No branches or pull requests

1 participant