feat: implement concurrent trigram index building#11
Conversation
- Introduced a worker pool and collector pattern in Builder.Build for parallel file processing. - Updated benchcmd to use the concurrent approach for accurate performance measurement. - Improved indexing speed on Go stdlib corpus by ~1.9x.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 38 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Go toolchain version is bumped from 1.20 to 1.25.0, and two dependencies are promoted to direct requirements. File processing in the index builder and benchmark tools is refactored from single-threaded sequential operations to a producer/worker/consumer concurrency pattern using channels and goroutines. Changes
Sequence Diagram(s)sequenceDiagram
participant Main as Main Goroutine
participant Walker as Directory Walker
participant PathCh as paths Channel
participant Workers as Worker Goroutines
participant ResultCh as results Channel
participant Consumer as Consumer Goroutine
participant Builder as Builder State
Main->>Walker: Start directory walk
Walker->>PathCh: Enqueue file paths
PathCh->>Workers: Send path
Workers->>Workers: Validate file (UTF-8, size)
Workers->>Workers: Extract trigrams
Workers->>ResultCh: Send extractResult
ResultCh->>Consumer: Receive result
Consumer->>Builder: Assign fileID<br/>(stable, based on b.Files length)
Consumer->>Builder: Append file path
Consumer->>Builder: Batch-add trigram mappings
Main->>Main: Wait for all workers & consumer
Main->>Builder: Call Posts.Finalize()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit