← Back to Pull requests

[clang-tidy] Start the largest files first in run-clang-tidy #243430

Open
unknown opened this pull request with 165 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 17, 2026 11:28 UTC
Author

run-clang-tidy.py keeps the files from the compilation database in a set, so it starts them in an arbitrary order that changes from run to run (#73357). When a few files take much longer than the rest, a run waits on whichever of them happens to start last.

This starts the files with the most code to check first: a file's size times its number of compile commands, since clang-tidy checks a file once for each of its commands. Ties break by path, and files that can't be read sort last.

To test it, I measured clang-tidy's CPU time per file (--checks='*') on 17 open-source projects, 4,086 files in all, and replayed the scheduler at 16 jobs. Against today's random order, starting the largest files first was 7.1% faster on average but made re2 29% and curl 21% slower. Their slowest files are small but compiled into many targets: re2's util/test.cc has 20 entries in the database, and curl's tests/libtest/first.c has 285. Weighting by the number of commands is 12.0% faster, with no project slower. An order that knew every file's true time would be 13.4% faster.

#73357 suggests keeping the database order instead. CMake writes it in declaration order, and in these projects that is no faster than random on average and up to 28% slower (poco).

🤖 Generated with Claude Code

Diff: 165 lines (+123 / -42) across 2 files Reviewer: zeyi2 Review duration: 23377m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 165 lines diff across 2 files
0.35
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
46%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.306
Real PR Conversation Timeline
1 comments
"Review active on #243430"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 46.7% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35% (MEDIUM) · Higher = larger blast radius
35%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 46.7% · Lower = rushed or shallow review
46.7%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 18.7% · Safe to merge
18.7%