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

[Enhancement]: Lazy generators for Block Tree getters #2105

Open
Harrm opened this issue May 21, 2024 · 1 comment
Open

[Enhancement]: Lazy generators for Block Tree getters #2105

Harrm opened this issue May 21, 2024 · 1 comment
Assignees

Comments

@Harrm
Copy link
Contributor

Harrm commented May 21, 2024

Description

BlockTree has some methods that return chains as vectors. Allocating a vector for a getter is unoptimal, we can just return an iterator (external or internal) instead. C++20 coroutines and C++23 generator are a nice way to implement an external iterator. However, we should be careful about multithreaded access to block tree in this case.

Motivation

Optimization of large chain requests.

Additional context

No response

Are you planning to do it yourself in a pull request ?

Yes

@Harrm Harrm self-assigned this May 21, 2024
@turuslan
Copy link
Contributor

Maybe reuse Descent class, which preloads batches lazily

/**
* Cached ancestry check.
*/
struct Descent {

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

2 participants