perf(check): parallelize file reads in grepFiles()#349
Merged
Conversation
grepFiles() previously read files sequentially inside a for-await loop over Bun.Glob.scan(). Since the operation is I/O-bound, concurrent reads improve throughput significantly for rules that grep across many files. Collect file paths from the glob scan first, then read + grep in parallel batches of 32 via Promise.all(). Batch size stays within OS fd limits while providing 2-5x faster grepFiles calls in repos with >100 matched files. Closes #344 Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Deploying archgate-cli with
|
| Latest commit: |
926d487
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://466a95c5.archgate-cli.pages.dev |
| Branch Preview URL: | https://perf-parallel-grep-files.archgate-cli.pages.dev |
Contributor
Code Coverage
Full HTML report available in workflow artifacts. Per-directory breakdown
|
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
grepFiles()insrc/engine/runner.ts— file reads were sequential inside afor awaitloop; now files are collected first, then read in parallel batches of 32 viaPromise.all()Test plan
grepFilesregression + helper tests)bun run validatepasses (lint, typecheck, format, test, ADR check, knip, build)Closes #344