Commit 1dc466c
perf(detector/auth): tight pre-screen on CertificateAuthDetector
CPU profile of indexing PSScriptAnalyzer (593 files, mostly C#) showed
CertificateAuthDetector consuming 99% of CPU (137 of 138 sample-seconds
in regexp.match). Root cause: the detector's file-level pre-screen
included .pem/.crt/.cert path-extension keywords that match almost every
.NET file via `using System.Security.Cryptography.X509Certificates;` and
similar, defeating the gate.
Fix: split out a STRICT keyword list (certStrictKeywords) that drops the
path-extension keywords and keeps only high-signal markers
(SSLContext, X509AuthenticationFilter, AzureAd, etc). Used as both
file-level and per-line gate before running the 20 per-pattern regexes.
Bench (rm -rf .codeiq && time codeiq index PSScriptAnalyzer):
- before: 42.9s wall, 2m20s CPU
- after: 18.4s wall, 32.5s CPU
Node counts unchanged (1674 nodes / 872 edges).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 336309c commit 1dc466c
1 file changed
Lines changed: 38 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
84 | 108 | | |
85 | 109 | | |
86 | 110 | | |
87 | 111 | | |
88 | 112 | | |
89 | | - | |
| 113 | + | |
90 | 114 | | |
91 | 115 | | |
92 | 116 | | |
| |||
95 | 119 | | |
96 | 120 | | |
97 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
98 | 127 | | |
99 | 128 | | |
100 | 129 | | |
| |||
0 commit comments