test: improve BTreeMap bench coverage and readability#285
Conversation
|
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the BTreeMap benchmarks by introducing support for unbounded types via a new FixedVec, removing all legacy V1 benchmarks, and updating the main benchmark harness for coverage and readability improvements.
- Add a
FixedVectype withStorableimplementation to cover unbounded-size tests. - Remove the generated
canbench_results.csvfile to avoid stale benchmark data. - Update
benchmarks/src/main.rsto importFixedVecand provide aRandomimplementation for it.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/storable.rs | Introduced FixedVec, implemented Storable |
| canbench_results.csv | Deleted outdated benchmark results |
| benchmarks/src/main.rs | Imported FixedVec and added Random impl |
Comments suppressed due to low confidence (3)
src/storable.rs:201
- [nitpick] The method name
frommay be confusing and doesn't implement the standardFromtrait. Rename it tonewor implementFrom<&[u8]> for FixedVec<N>for consistency with Rust conventions.
pub fn from(slice: &[u8]) -> Self {
src/storable.rs:192
- [nitpick] Consider expanding the doc comment to explain that
FixedVecis always padded to lengthN, and document the behavior ofmax_sizeand the constructor.
/// Byte-vector for testing size N; otherwise just a Vec<u8>.
src/storable.rs:210
- There are no unit tests for
FixedVec. Adding tests to verify padding,max_size, serialization, and deserialization behavior would improve confidence in its correctness.
impl<const N: usize> Storable for FixedVec<N> {
|
@dsarlis I am reviving this PR again, removed V1 benchmarks and synced to the new canbench reporting format. PTAL |
dsarlis
left a comment
There was a problem hiding this comment.
Still adding new benchmarks must be handled with care because pocket_ic has a limitation on the number of tests (10k) and the total length of test names (20k chars). This limit is going to be increased soon.
From the PR description, is this still true? I suppose not because the new version of canbench should have lifted this restriction.
This PR refactors BTreeMap benchmarks to increase coverage and improve readability.
Current benchmark setup has some challenges:
New benchmark setup:
FixedVecfor v2)Still adding new benchmarks must be handled with care because pocket_ic has a limitation on the number of tests (10k) and the total length of test names (20k chars). This limit is going to be increased soon.Getting closer to this limit increases running time up to 7 minutes and increases significantly the size of canbench report, which is currently is not very readable.
Current setup supports:
CSV report in google sheets.