All rules

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

Triggers the rule
+ foreach (var id in ids)
+ {
+     var match = users.FirstOrDefault(u => u.Id == id);
+     Thread.Sleep(10);
+ }
Passes the rule
+ 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

Implemented in src/GauntletCI.Core/Rules/Implementations/GCI0044_*.cs.

About the author

Eric Cogen -- Founder, GauntletCI

Twenty years in .NET production. Most of those years, the bugs that hurt me were not the ones tests caught. They were the assumptions I did not know I was making: a removed guard clause, a renamed method that still did the old thing, a catch {} that turned a page into a silent dashboard lie. GauntletCI is the checklist I wish I had run before every commit. It runs the rules I learned the hard way, so you do not have to.