Skip to content

Comments

Implemented smart hashing of batch updates for LMT#305

Merged
rpanic merged 3 commits intodevelopfrom
feature/tree-batch-update-2
May 21, 2025
Merged

Implemented smart hashing of batch updates for LMT#305
rpanic merged 3 commits intodevelopfrom
feature/tree-batch-update-2

Conversation

@rpanic
Copy link
Member

@rpanic rpanic commented Apr 13, 2025

This PR introduces a new batch-setLeaf algorithm that optimizes the amount of hashes we have to do.
The tldr on this is that if we set each leaf after the other, we do $height$ amount of hashes, but we can be smart about it and go level by level, in the process merging paths of leaves where they converge.
This is less useful for the previous tree implementation, where the leafs are randomly distributed and therefore very sparse. But for the LMT, where we place leafs one-by-one strictly incrementing their tree index, big parts of the paths will overlay, therefore giving us a decent speedup for batch updates.

LMT with batch update vs. vanilla LMT
100 transfers with unqiue state slots:

result generation:
5357ms vs 6987ms
therefore roughly a 30% speedup

This was referenced Apr 14, 2025
@rpanic rpanic changed the base branch from feature/tps-test-2 to develop May 21, 2025 08:35
@rpanic rpanic merged commit b413b32 into develop May 21, 2025
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.

1 participant