feat: implement buffered iterators to speed up search operations #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses issue #3 by implementing buffered lock-free iterators to replace the
Vec::with_capacity+vec.push+vec.into_iter()pattern, significantly improving iterator performance.buffered-iterfeature with backward compatibilitypar_each_iter,each_iter,each_iter_small,delete_query_with,delete_usages_with,usagesChanges Made
Dependencies
buter = "1.2.4"as optional dependencybuffered-iterfeature flagfullfeature to includebuffered-iterCore Implementation
Replaced the common pattern:
Version & Testing
0.1.0-pre+beta.16examples/buffered_iterator_test.rsUsage
Enable buffered iterators:
cargo build --features buffered-iter # or cargo build --features fullDefault behavior (backward compatible):
cargo build # Uses Vec fallbackPerformance Benefits
According to buter crate benchmarks:
buteroperations: ~14 ns/itervec.push: ~212 ns/itervec.pushwith capacity: ~54 ns/iterThis represents a 3-15x performance improvement for iterator-heavy operations.
Files Changed
doublets/Cargo.toml- Dependencies and featuresdoublets/src/data/traits.rs- Core implementationexamples/buffered_iterator_test.rs- Performance demoIMPLEMENTATION_NOTES.md- Detailed documentationTest Plan
🤖 Generated with Claude Code
Resolves #3