Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: remove mutable mmr #5954

Merged
merged 2 commits into from Nov 16, 2023

Conversation

SWvheerden
Copy link
Collaborator

Description

removes croaring and the mutable mmr struct

Motivation and Context

There are not used anymore

@ghpbot-tari-project ghpbot-tari-project added the CR-insufficient_context Your PRs commit messages don't provide enough context to justify accepting the change. label Nov 14, 2023
Copy link

github-actions bot commented Nov 14, 2023

Test Results (CI)

1 248 tests   1 248 ✔️  11m 53s ⏱️
     39 suites         0 💤
       1 files           0

Results for commit 24a19eb.

♻️ This comment has been updated with latest results.

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Nov 14, 2023
Copy link

github-actions bot commented Nov 14, 2023

Test Results (Integration tests)

  2 files  11 suites   57m 47s ⏱️
31 tests 30 ✔️ 0 💤 1
33 runs  30 ✔️ 0 💤 3

For more details on these failures, see this check.

Results for commit 24a19eb.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@brianp brianp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. utAck

@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label Nov 14, 2023
@CjS77
Copy link
Collaborator

CjS77 commented Nov 14, 2023

It's a breaking change, so will need a major version change on the crate at next release.

Edit: though it looks like we haven't published it in a while: https://crates.io/crates/tari_mmr

@SWvheerden
Copy link
Collaborator Author

t's a breaking change, so will need a major version change on the crate at next release.

Yeah its synced to the tari version atm which is 0.53.0

@SWvheerden SWvheerden changed the title chore: remove mutable mmr chore!: remove mutable mmr Nov 14, 2023
t
}

pub fn root_hash(_c: &mut Criterion) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these operations be refactored to use Criterion's bench_function design? It might get a little tricky because of how its iterations work, since you want to work on a fresh tree for each of its iterations to ensure the operations are being run as expected. But at least then you can probably get better timing data.

@@ -19,7 +19,7 @@ fn create_smt() -> SparseMerkleTree<Blake2b<U32>> {
SparseMerkleTree::<Blake2b<U32>>::new()
}

pub fn benchmark_sparse_merkle_trees(c: &mut Criterion) {
pub fn benchmark_smt_insert(c: &mut Criterion) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this more closely, I think there's a subtle error in this benchmark. A fresh tree is created for each sample, but then each iteration of that sample applies the upsert operations to the same tree. This means the first iteration will perform inserts, and subsequent iterations will perform updates. The timing data will only be accurate if an insert and update take the same amount of time.

@AaronFeickert
Copy link
Collaborator

Since rewriting the benchmarks to use a more standard Criterion design might take a bit, should this be merged as is? Benchmarks could be improved separately.

@SWvheerden SWvheerden merged commit 0855583 into tari-project:development Nov 16, 2023
13 of 14 checks passed
@SWvheerden SWvheerden deleted the sw_remove_mut_mmr branch November 16, 2023 06:20
@AaronFeickert
Copy link
Collaborator

Fixes and updates to the benchmarks are addressed in #5962.

SWvheerden pushed a commit that referenced this pull request Nov 20, 2023
Description
---
Updates and fixes Merkle benchmarks.

Closes #5962.

Motivation and Context
---
Recent work in #5954 removes mutable Merkle mountain range (MMR) code,
which became unused with the addition of sparse Merkle trees (SMTs).
Some existing benchmarks were removed or moved to accommodate this
change. During review, some minor issues were identified:
- An existing MMR and SMT benchmark reused tree structures between
benchmark iterations, which could provide incorrect timing data.
- New SMT benchmarks used bespoke timing code that didn't take full
advantage of Criterion's functionality.

This PR fixes these issues, albeit at the expense of more benchmark
setup overhead. This shouldn't be particularly problematic, as
benchmarks are only run manually as needed.

How Has This Been Tested?
---
The benchmarks run and appear to give reasonable data.

What process can a PR reviewer use to test or verify this change?
---
Check that the updated and new benchmarks exercise the desired
functionality. Check that operations use fresh tree structures for each
test iteration as needed, to ensure correct timing data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR-insufficient_context Your PRs commit messages don't provide enough context to justify accepting the change. P-acks_required Process - Requires more ACKs or utACKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants