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

Exponential memory allocation strategy when creating a tree from a foldable #3

Open
larskuhtz opened this issue Jan 22, 2019 · 0 comments

Comments

@larskuhtz
Copy link
Collaborator

Currently createMerkleTree takes a list. It traverses the list first to find out the length and allocate the memory for the tree before traversing the list for computing the hashes as the input items. Depending on the type of the input list and the source and size of the input items this may pull large amount of data input memory (possibly via IO).

Instead there should be different methods for creating trees depending of whether the length of the input is know in advance or not. In the former case the current strategy should be use that makes a single allocation for the correct size of memory. In the latter case and exponential allocation strategy should be used.

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