mirror of
https://github.com/arnaucube/arbo.git
synced 2026-01-08 15:01:29 +01:00
f31ed1d2d1ad4d258183a81184af698ceadce316
Reduces the num of hashes, dbGet and dbPut on cases D & E. Current benchmarks: ``` CASE A, AddBatch was 9.101855 times faster than without AddBatch nCPU: 4, nLeafs: 1024, hash: Poseidon, db: memory dbgStats(hash: 2.047k, dbGet: 1, dbPut: 2.049k) CASE B, AddBatch was 8.244078 times faster than without AddBatch nCPU: 4, nLeafs: 1024, hash: Poseidon, db: memory dbgStats(hash: 2.047k, dbGet: 198, dbPut: 2.049k) CASE C, AddBatch was 8.511131 times faster than without AddBatch nCPU: 4, nLeafs: 1024, hash: Poseidon, db: memory dbgStats(hash: 2.047k, dbGet: 202, dbPut: 2.049k) CASE D, AddBatch was 8.565696 times faster than without AddBatch nCPU: 4, nLeafs: 4096, hash: Poseidon, db: memory dbgStats(hash: 8.191k, dbGet: 1.800k, dbPut: 8.193k) CASE E, AddBatch was 8.970056 times faster than without AddBatch nCPU: 4, nLeafs: 4096, hash: Poseidon, db: memory dbgStats(hash: 10.409k, dbGet: 2.668k, dbPut: 10.861k) TestAddBatchBench: nCPU: 4, nLeafs: 50000, hash: Blake2b, db: leveldb Add loop: 10.616145533s dbgStats(hash: 824.884k, dbGet: 788.975k, dbPut: 924.884k) AddBatch: 942.34815ms dbgStats(hash: 122.051k, dbGet: 1, dbPut: 122.053k) TestDbgStats add in loop dbgStats(hash: 141.911k, dbGet: 134.650k, dbPut: 161.911k) addbatch caseA dbgStats(hash: 24.522k, dbGet: 1, dbPut: 24.524k) addbatch caseD dbgStats(hash: 26.985k, dbGet: 2.465k, dbPut: 26.989k) ```
arbo

arbo: tree in Esperanto.
MerkleTree implementation in Go. Compatible with the circomlib implementation of the MerkleTree (when using the Poseidon hash function), following the specification from https://docs.iden3.io/publications/pdfs/Merkle-Tree.pdf and https://eprint.iacr.org/2018/955.
Allows to define which hash function to use. So for example, when working with zkSnarks the Poseidon hash function can be used, but when not, it can be used the Blake3 hash function, which improves the computation time.
Languages
Go
97.9%
TypeScript
2.1%