Performance Hotpath Risk
Detects Thread.Sleep, LINQ queries inside loops, and unbounded collection growth inside loops that degrade throughput in hot paths.
Why this rule exists
Thread.Sleep blocks a thread-pool thread. LINQ inside a loop turns O(n) into O(n^2). Unbounded list growth turns a 100-item test into an OOM at 100k items. None of these show up in unit tests.
Code example
+ foreach (var id in ids)
+ {
+ var match = users.FirstOrDefault(u => u.Id == id);
+ Thread.Sleep(10);
+ }+ var byId = users.ToDictionary(u => u.Id);
+ foreach (var id in ids)
+ {
+ var match = byId.GetValueOrDefault(id);
+ await Task.Delay(10, ct);
+ }Configuration
Disable or adjust the severity of this rule in .gauntletci.json:
{
"rules": {
"GCI0044": { "enabled": true, "severity": "Info" }
}
}See Configuration for the full schema.
Related rules
Concurrency and State Risk
Detects async void methods, blocking async calls (.Result, .Wait(), .GetAwaiter().GetResult()), lock(this), and Thread.Sleep in production code. Uses ForPatternScan to ignore matches inside // comments and string literals.
Resource Lifecycle
Detects disposable resources allocated without a using statement or try/finally disposal, leading to connection and handle leaks.
Discussed in
The Asymmetry of Change: Why Your Tests Are Looking the Wrong Way
Why passing tests don't guarantee correct behavior. How diff-scanning can close the gap between code changes and test validation.
Can AI Code Review Tools Ever Be Deterministic?
Exploring the difference between helpful AI review and trustworthy engineering controls. Why determinism matters more than you think.
A "Performance Improvement" PR Introduced 11 Block-Level Risks
Jellyfin PR #16062 escaped code review despite introducing 11 block-level risks. Discover why traditional tools miss behavioral regressions.
Best AI Code Review Tools for Pull Requests
How to evaluate AI code review tools by evidence quality, repeatability, CI fit, noise control, and merge-gate safety.
Implemented in src/GauntletCI.Core/Rules/Implementations/GCI0044_*.cs.
Eric Cogen -- Founder, GauntletCI
Twenty years as a senior technical consultant building and modernizing enterprise platforms across .NET, AWS, serverless, microservices, and AI-driven systems.
