`SimpleSmt` insertion optimization
- Ngôn ngữ chính
- Rust
- Star
- 772
- Fork
- 352
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 84
Mô tả
Currently `SimpleSmt` recomputes inner node hashes on each insert. It computes and writes hashes starting from inserted node and up to the root. It might lead to unnecessary computations during bulk inserts (for example, `SimpleSmt::with_leaves` and `SimpleSmt::with_contiguous_leaves` use `insert` under the hood).
We can use different approaches for such optimization. For example:
1. Simply disable hashes calculations during bulk inserts and then create all needed inner nodes with hashes computation after operation. This approach should work fine for populating constructors (`with_leaves`, and similar).
2. Mark hashes, affected during insertion, as invalid. Recalculate lazily only invalid hashes on access to root hash. This is little more complex approach, but should work fine for random inserts.
Hướng dẫn đóng góp
Hướng nghiên cứu
Look at the SimpleSmt implementation, likely in a file like simple_smt.rs or similar. Understand how insert currently recomputes inner node hashes. The issue suggests two optimization approaches: bulk insert with deferred hash computation or lazy recalculation of invalidated hashes. Start by examining the with_leaves and with_contiguous_leaves methods to see how they call insert. Determine the data structures for tracking hash validity and the root hash access patterns.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- cryptography
- Loại issue
- Tái cấu trúc
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100