zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Improve note commitment tree append performance

Open teor2345 opened this issue 1 year ago • 0 comments

Motivation

Alfredo and I have been doing some timing tests on Zebra's CommitBlock and CommitFinalizedBlock state requests.

In some of my tests, Sapling note commitment tree appends were taking multiple seconds to run. This is probably due to the large number of new Sapling notes in the chain.

We should try to improve performance of this code.

Suggested Changes

Add benchmarks for:

  • note commitment tree appends on random notes
  • note commitment tree appends on large sprout, sapling, and orchard blocks (#4774 & #4775)
  • note conversion to the correct type
  • the inner functions that do the update, without acquiring the ReadWriteLock

Once we have benchmarks, try to improve the performance of the code:

  • pass a vector to the append method, and only acquire the ReadWriteLock once
  • inline the functions that are called when appending note commitment trees
  • try different compiler options?

teor2345 avatar Jul 28 '22 23:07 teor2345