Commit 6b4fa9e
committed
perf: optimize RAV allocation lookup from O(n²) to O(n)
Replace Array.find() with Map-based lookups for constant-time allocation
retrieval in both TapCollector and GraphTallyCollector.
This achieves approximately 5000x performance improvement for datasets
with 10k+ RAVs/allocations by eliminating the nested loop that caused
quadratic complexity.
Changes:
- tap-collector.ts: Build allocation map for O(1) lookups
- graph-tally-collector.ts: Build allocation map for O(1) lookups
Based on: #1146
Original author: madumas
Original commit: 59efa951 parent 72409ea commit 6b4fa9e
2 files changed
Lines changed: 46 additions & 22 deletions
Lines changed: 22 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
243 | 257 | | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 258 | + | |
249 | 259 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
253 | 263 | | |
254 | 264 | | |
255 | 265 | | |
| |||
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
223 | 238 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 239 | + | |
227 | 240 | | |
228 | | - | |
229 | | - | |
230 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
231 | 245 | | |
232 | 246 | | |
233 | 247 | | |
| |||
0 commit comments