perf: add batch read of BTreeMap node children addresses#364
Conversation
|
|
|
|
|
There was a problem hiding this comment.
Pull Request Overview
Improves BTreeMap performance by introducing a batch-read helper and using it when loading internal node children.
- Adds
read_address_vecinsrc/lib.rsfor efficient bulk reading ofAddressvalues. - Refactors child-loading in
src/btreemap/node/v2.rsto choose between individual reads and batch reads based on a threshold. - Updates imports in
src/btreemap/node.rsand refreshes benchmark results.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | New read_address_vec function for batched Address reads. |
| src/btreemap/node/v2.rs | Switched internal-node child-loading to use read_address_vec. |
| src/btreemap/node.rs | Imported read_address_vec. |
| benchmarks/compare/canbench_results.yml | Updated instruction counts after performance changes. |
| benchmarks/btreeset/canbench_results.yml | Updated instruction counts after performance changes. |
| benchmarks/btreemap/canbench_results.yml | Updated instruction counts after performance changes. |
Comments suppressed due to low confidence (1)
src/lib.rs:134
- This new utility function
read_address_vecingests raw bytes into addresses; consider adding a unit test forread_address_vecto validate correct behavior for differentcountvalues and boundary cases.
read_to_vec(m, addr, &mut buf, byte_len);
This PR introduces batch writing of BTreeMap node children addresses to improve performance. This PR follows the idea from #364 to batch individual writes. Although there are no significant changes overall, the majority of cases show slight improvements (p25–p75: approx -0.07%), with: worst +0.27%, median 0.00%, best -1.28%. btreemap ``` instructions: status: No significant changes 👍 counts: [total 285 | regressed 0 | improved 0 | new 0 | unchanged 285] change: [max +1.43M | p75 0 | median 0 | p25 -637.40K | min -10.48M] change %: [max +0.27% | p75 0.00% | median 0.00% | p25 -0.07% | min -1.28%] ```
This PR introduces batch reading of
BTreeMapnode children addresses to improve performance.compare
btreeset
btreemap