Some optimizations of the archival-MMR which is used extensively by the archival mutator set.
The method prove_membership_async changes its interface to only return the authentication path (membership proof) and not also the peaks of the MMR. If the peaks are needed, they can be requested separately.
append is more than 2x faster, and more than 10x (30x in one measurement) faster for the append_and_persist benchmark. The other benchmarks show improvements of around 20-50 %.
append and batch_mutate_leaf_and_update_mps are the most relevant methods, as they are used by the archival mutator set which is what we're aiming to speed up in #127.
Previous code:
Timer precision: 20 ns
archival_mmr fastest │ slowest │ median │ mean │ samples │ iters
├─ append │ │ │ │ │
│ ╰─ append_5000 │ │ │ │ │
│ ├─ append 20.34 ms │ 76.49 ms │ 24.05 ms │ 24.84 ms │ 100 │ 100
│ ╰─ append_and_persist 35.23 ms │ 571.3 ms │ 316.2 ms │ 315.8 ms │ 100 │ 100
├─ batch_mutate_leaf_and_update_mps │ │ │ │ │
│ ╰─ mutate_100_of_10000 │ │ │ │ │
│ ├─ leaf_mutation 1.67 ms │ 3.219 ms │ 1.682 ms │ 1.725 ms │ 100 │ 100
│ ╰─ leaf_mutation_and_persist 23.85 ms │ 37.78 ms │ 28.61 ms │ 28.21 ms │ 100 │ 100
╰─ mutate │ │ │ │ │
╰─ mutate_100_of_10000 │ │ │ │ │
├─ leaf_mutation 1.907 ms │ 2.419 ms │ 1.943 ms │ 2.002 ms │ 100 │ 100
╰─ leaf_mutation_and_persist 30.19 ms │ 45.85 ms │ 35.24 ms │ 36.32 ms │ 100 │ 100
This PR:
Timer precision: 50 ns
archival_mmr fastest │ slowest │ median │ mean │ samples │ iters
├─ append │ │ │ │ │
│ ╰─ append_5000 │ │ │ │ │
│ ├─ append 8.73 ms │ 62.24 ms │ 9.767 ms │ 10.69 ms │ 100 │ 100
│ ╰─ append_and_persist 17.61 ms │ 28.69 ms │ 18.86 ms │ 19.34 ms │ 100 │ 100
├─ batch_mutate_leaf_and_update_mps │ │ │ │ │
│ ╰─ mutate_100_of_10000 │ │ │ │ │
│ ├─ leaf_mutation 1.479 ms │ 2.247 ms │ 1.485 ms │ 1.537 ms │ 100 │ 100
│ ╰─ leaf_mutation_and_persist 18.14 ms │ 29.83 ms │ 26.65 ms │ 26.43 ms │ 100 │ 100
╰─ mutate │ │ │ │ │
╰─ mutate_100_of_10000 │ │ │ │ │
├─ leaf_mutation 1.328 ms │ 2.682 ms │ 1.336 ms │ 1.392 ms │ 100 │ 100
╰─ leaf_mutation_and_persist 8.355 ms │ 25.51 ms │ 9.262 ms │ 9.466 ms │ 100 │ 100
Some optimizations of the archival-MMR which is used extensively by the archival mutator set.
The method
prove_membership_async
changes its interface to only return the authentication path (membership proof) and not also the peaks of the MMR. If the peaks are needed, they can be requested separately.append
is more than 2x faster, and more than 10x (30x in one measurement) faster for theappend_and_persist
benchmark. The other benchmarks show improvements of around 20-50 %.append
andbatch_mutate_leaf_and_update_mps
are the most relevant methods, as they are used by the archival mutator set which is what we're aiming to speed up in #127.Previous code:
This PR:
This closes #126.