Commit d30fd56
authored
[LifetimeSafety] Enhance benchmark script for new sub analyses (#149577)
Enhanced the lifetime safety analysis benchmark script with more
detailed performance metrics and a new nested loop test case. This is a
worst case for loan expiry analysis.
### What changed?
- Added a new test case `nested_loops` that generates code with N levels
of nested loops to test how analysis performance scales with loop
nesting depth
- Improved the trace file analysis to extract durations for sub-phases
of the lifetime analysis (FactGenerator, LoanPropagation, ExpiredLoans)
- Enhanced the markdown report generation to include:
- Relative timing results as percentages of total Clang time
- More detailed complexity analysis for each analysis phase
Report
# Lifetime Analysis Performance Report
> Generated on: 2025-08-18 13:29:57
---
## Test Case: Pointer Cycle in Loop
**Timing Results:**
| N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) |
Loan Propagation (%) | Expired Loans (%) |
|:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:|
| 10 | 10.75 ms | 24.61% | 0.00% | 24.38% | 0.00% |
| 25 | 64.98 ms | 86.08% | 0.00% | 86.02% | 0.00% |
| 50 | 709.37 ms | 98.53% | 0.00% | 98.51% | 0.00% |
| 75 | 3.13 s | 99.63% | 0.00% | 99.63% | 0.00% |
| 100 | 9.44 s | 99.85% | 0.00% | 99.84% | 0.00% |
| 150 | 45.31 s | 99.96% | 0.00% | 99.96% | 0.00% |
**Complexity Analysis:**
| Analysis Phase | Complexity O(n<sup>k</sup>) |
|:------------------|:--------------------------|
| Total Analysis | O(n<sup>3.87</sup> ± 0.01) |
| FactGenerator | (Negligible) |
| LoanPropagation | O(n<sup>3.87</sup> ± 0.01) |
| ExpiredLoans | (Negligible) |
---
## Test Case: CFG Merges
**Timing Results:**
| N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) |
Loan Propagation (%) | Expired Loans (%) |
|:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:|
| 10 | 8.54 ms | 0.00% | 0.00% | 0.00% | 0.00% |
| 50 | 40.85 ms | 65.09% | 0.00% | 64.61% | 0.00% |
| 100 | 207.70 ms | 93.58% | 0.00% | 93.46% | 0.00% |
| 200 | 1.54 s | 98.82% | 0.00% | 98.78% | 0.00% |
| 400 | 12.04 s | 99.72% | 0.00% | 99.71% | 0.01% |
| 800 | 96.73 s | 99.94% | 0.00% | 99.94% | 0.00% |
**Complexity Analysis:**
| Analysis Phase | Complexity O(n<sup>k</sup>) |
|:------------------|:--------------------------|
| Total Analysis | O(n<sup>3.01</sup> ± 0.00) |
| FactGenerator | (Negligible) |
| LoanPropagation | O(n<sup>3.01</sup> ± 0.00) |
| ExpiredLoans | (Negligible) |
---
## Test Case: Deeply Nested Loops
**Timing Results:**
| N (Input Size) | Total Time | Analysis Time (%) | Fact Generator (%) |
Loan Propagation (%) | Expired Loans (%) |
|:---------------|-----------:|------------------:|-------------------:|---------------------:|------------------:|
| 10 | 8.25 ms | 0.00% | 0.00% | 0.00% | 0.00% |
| 50 | 27.25 ms | 51.87% | 0.00% | 45.71% | 5.93% |
| 100 | 113.42 ms | 82.48% | 0.00% | 72.74% | 9.62% |
| 200 | 730.05 ms | 95.24% | 0.00% | 83.95% | 11.25% |
| 400 | 5.40 s | 98.74% | 0.01% | 87.05% | 11.68% |
| 800 | 41.86 s | 99.62% | 0.00% | 87.77% | 11.84% |
**Complexity Analysis:**
| Analysis Phase | Complexity O(n<sup>k</sup>) |
|:------------------|:--------------------------|
| Total Analysis | O(n<sup>2.97</sup> ± 0.00) |
| FactGenerator | (Negligible) |
| LoanPropagation | O(n<sup>2.96</sup> ± 0.00) |
| ExpiredLoans | O(n<sup>2.97</sup> ± 0.00) |
---1 parent 4b94c08 commit d30fd56
1 file changed
+161
-66
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
105 | 108 | | |
106 | | - | |
107 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
108 | 149 | | |
109 | | - | |
110 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
111 | 168 | | |
112 | 169 | | |
113 | 170 | | |
114 | 171 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
120 | 176 | | |
121 | 177 | | |
122 | | - | |
123 | | - | |
| 178 | + | |
| 179 | + | |
124 | 180 | | |
125 | 181 | | |
126 | 182 | | |
| |||
135 | 191 | | |
136 | 192 | | |
137 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
138 | 215 | | |
139 | | - | |
| 216 | + | |
140 | 217 | | |
141 | 218 | | |
142 | 219 | | |
| |||
146 | 223 | | |
147 | 224 | | |
148 | 225 | | |
149 | | - | |
| 226 | + | |
150 | 227 | | |
151 | 228 | | |
152 | | - | |
153 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
154 | 235 | | |
155 | 236 | | |
156 | 237 | | |
157 | | - | |
158 | | - | |
| 238 | + | |
159 | 239 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
194 | 264 | | |
195 | | - | |
196 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
197 | 272 | | |
198 | 273 | | |
199 | 274 | | |
| |||
202 | 277 | | |
203 | 278 | | |
204 | 279 | | |
205 | | - | |
| 280 | + | |
206 | 281 | | |
207 | 282 | | |
208 | 283 | | |
| |||
221 | 296 | | |
222 | 297 | | |
223 | 298 | | |
224 | | - | |
| 299 | + | |
| 300 | + | |
225 | 301 | | |
226 | 302 | | |
227 | 303 | | |
| |||
231 | 307 | | |
232 | 308 | | |
233 | 309 | | |
234 | | - | |
| 310 | + | |
235 | 311 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
239 | 316 | | |
240 | 317 | | |
241 | 318 | | |
| |||
270 | 347 | | |
271 | 348 | | |
272 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
273 | 356 | | |
274 | 357 | | |
275 | 358 | | |
| |||
282 | 365 | | |
283 | 366 | | |
284 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
285 | 371 | | |
286 | 372 | | |
287 | | - | |
| 373 | + | |
288 | 374 | | |
289 | 375 | | |
290 | 376 | | |
291 | 377 | | |
292 | 378 | | |
293 | 379 | | |
294 | | - | |
| 380 | + | |
295 | 381 | | |
296 | | - | |
297 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
298 | 385 | | |
299 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
300 | 390 | | |
301 | 391 | | |
302 | 392 | | |
| |||
305 | 395 | | |
306 | 396 | | |
307 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
0 commit comments