Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize calculation of ledger hashes
Problem: when performing transaction application, all merkle ledger hashes are recomputed for every account update. This is wasteful for a number of reasons: 1. Transactions normally contain more than one account update and hashes computed by an account update are overwritten by a subsequent account update 2. Ledger's depth is 35, whereas only around 2^18 are actually populated. This means that each account update induces a wasteful overhead of at least 17 hashes Solution: defer computation of hashes in mask. When an account is added, it's stacked in a list `unhashed_accounts` of masks which is processed at the time of next access to hashes. This fix improved performance of handling 9-account-update transactions by ~60% (measured on a laptop).
- Loading branch information