Commit c37ee19
Fix per-file RegexSet recompilation in find_library_anchors
The find_library_anchors function was creating a new RegexSet on every
file scan by collecting include patterns and compiling them fresh. With
~1000 patterns, this added significant overhead per file.
Fix: Pre-compile the include RegexSet per language during PatternSet
initialization and store library ownership indices. The function now
uses the pre-compiled set directly.
Performance improvement:
- library_anchors/python: 228µs → 25µs (~9x faster)
- full_pipeline/python: 3.07ms → 2.75ms (~10% faster)
- directory_scale/files/1000: 246ms → 235ms (~5% faster)
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>1 parent 46ef618 commit c37ee19
2 files changed
Lines changed: 36 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
76 | 84 | | |
77 | 85 | | |
78 | 86 | | |
79 | 87 | | |
80 | 88 | | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
173 | 183 | | |
174 | 184 | | |
175 | 185 | | |
176 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
177 | 190 | | |
178 | 191 | | |
| 192 | + | |
179 | 193 | | |
180 | 194 | | |
| 195 | + | |
181 | 196 | | |
182 | 197 | | |
183 | 198 | | |
| |||
188 | 203 | | |
189 | 204 | | |
190 | 205 | | |
| 206 | + | |
| 207 | + | |
191 | 208 | | |
192 | 209 | | |
193 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
194 | 219 | | |
195 | 220 | | |
196 | 221 | | |
| |||
203 | 228 | | |
204 | 229 | | |
205 | 230 | | |
| 231 | + | |
206 | 232 | | |
207 | 233 | | |
208 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | 108 | | |
| 109 | + | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
| |||
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 123 | | |
130 | 124 | | |
131 | 125 | | |
132 | | - | |
| 126 | + | |
| 127 | + | |
133 | 128 | | |
134 | | - | |
| 129 | + | |
135 | 130 | | |
136 | | - | |
137 | 131 | | |
138 | 132 | | |
139 | | - | |
| 133 | + | |
140 | 134 | | |
141 | 135 | | |
142 | 136 | | |
| 137 | + | |
143 | 138 | | |
144 | | - | |
| 139 | + | |
145 | 140 | | |
146 | 141 | | |
147 | 142 | | |
| |||
0 commit comments