perf: do not wait for a check the build carries nothing of - #333
Merged
Merged
Conversation
A check whose `reportAs` leaves both its errors and its warnings off the compilation, and that writes no `outputReport`, has nothing for the build to wait for. In watch mode such a check is now run once the rebuild is over rather than beside it, and what it finds goes to the terminal through the infrastructure logger. The first build still waits, since it is what tells the watcher which files the check reads; from the rebuild on, the files of the last report are handed over instead. A report a newer compilation has overtaken is dropped, and a run waits for the last one of the same check, so a tool holding state between runs never has two of them in it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
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
A check whose
reportAsleaves both its errors and its warnings off the compilation, and that writes nooutputReport, has nothing a build can wait for — it only holds the rebuild up. In watch mode such a check is now run after the rebuild rather than beside it, and what it finds is printed through the infrastructure logger.The first build still waits: it is what tells the watcher which files the check reads (#330). From the rebuild on, the files of the last report are handed over instead. A report a newer compilation has overtaken is dropped, and a run waits for the previous one of the same check, so a tool that holds state between runs — the TypeScript program of #332 — never has two of them in it.
Measured on a 300-file project, one file changed, with an idle gap between edits (median of 5 rebuilds; no plugin = 42 ms):
The work is moved out of the rebuild, not off the machine: an edit arriving while such a check is still running waits for the rest of it (typescript: 226 → 266 ms when the next edit lands in the same millisecond the previous build ended). ESLint's tail here is a single file, which is why it does not move.
Refs #332.
What kind of change does this PR introduce?
perf
Did you add tests for your changes?
Yes —
test/advisory.test.js: the rebuild finishes with the check still running, a check the build does carry still holds it, the files only the check reads stay watched, a failure of a check and of its report reach the terminal, and a report a newer rebuild overtook is dropped.Does this PR introduce a breaking change?
No. A
reportAs: "log"check reachesstats.loggingon a one-shot build and on the first watch build as before; from the rebuild on its output goes to the infrastructure log.If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented in
README.mdunderreportAs.Use of AI
Claude Code wrote the change, the tests and this description, and ran the benchmarks above; I reviewed all of it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
Generated by Claude Code