feat: parallelize per-doc check loop with Io.Group#24
Merged
laulauland merged 2 commits intomainfrom Apr 17, 2026
Merged
Conversation
7c43686 to
6a592d2
Compare
e1e1ca5 to
3f6df57
Compare
b33cabc to
1180a84
Compare
1180a84 to
76292c2
Compare
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.
Stacked on #23. Merge #23 first, then rebase and merge this.
Summary
drift checkusingstd.Io.Group.git logfor blame) runs on a separate task. Docs are independent, so no shared state beyond pre-allocated result slots.Design
CommandContext. Each task builds its ownstd.heap.ArenaAllocator(child ofrun_arena) soctx.scratch()/ctx.resetScratch()incheckBinding,checkDocLinks,classifyRelativeLinkkeep working unchanged. The mainCommandContextkeepsscratch_arena; other commands are untouched.FileCache.std.StringHashMapisn't thread-safe. Each task gets its own cache. Docs rarely share files across each other; the lost hit rate is negligible.results: []?DocCheckResultallocated fromrun_arena, one per doc. Tasks write their own slot; the main thread merges in doc-order so output stays deterministic (docs are already sorted bydiscoverDocGroups).Io.Group.asynctasks can't return errors to the caller. AcheckOneDocwrapper catches errors from the inner function and stores them aserror_message: ?[]const u8on the result. The main thread prints the message and returnserror.LintCheckFailedduring merge — same external contract as before.Scope
Only
src/commands/lint.zigchanges (+173/−70).vcs.zig,lockfile.zig,markdown.zig, and other commands are untouched.Testing
zig buildpasses.zig build testpasses: 63 tests, 0 failures.drift checkagainst the real repo produces the same stale-anchor output as before (same paths, same reasons, same anchors, same sort order).drift check --format jsonstill emits valid JSON (onlychecked_at_msdiffers run-to-run).Deferred
Other options from the Io migration plan (speculative blame via
io.async,Io.Batchfor link checks, startup overlap ofgit ls-files||git remote get-url, persistent-GitCatFilerefactor) are separate follow-ups.