feat: implement buffered iterators to speed up search operations#40
Open
feat: implement buffered iterators to speed up search operations#40
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #3
- Replace Vec-based iterator collection with buffered lock-free iterators using `buter` crate - Add optional `buffered-iter` feature for performance optimization - Maintain backward compatibility with Vec fallback when feature disabled - Update 6 iterator functions: par_each_iter, each_iter, each_iter_small, delete_query_with, delete_usages_with, usages - Performance improvement: ~14 ns/iter vs 54-212 ns/iter with Vec - Increment version to 0.1.0-pre+beta.16 for release - Add comprehensive example demonstrating buffered iterator functionality Closes #3 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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