This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit be01b98
committed
Auto merge of rust-lang#10533 - Nilstrieb:cache, r=dswij
Significantly optimize `significant_drop_tightening`
The lint is very slow as it doesn't cache the deeply nested check for the attribute. If we cache it, we can reduce the time spent on checking `rustc_borrowck` from 28s to 9s, which is a nice improvement. In the profile, the time inside `has_sig_drop_attr` goes from 66% to 0.2%, which is a lot more reasonable.
<details>
<summary>Flame graphs</summary>
Before (all the tall `clippy` towers are `has_sig_drop_attr`):

After:

</details>
Fixes rust-lang#10532
changelog: [`significant_drop_tightening`]: significantly optimized1 file changed
+31
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| 300 | + | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
302 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
303 | 309 | | |
304 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
305 | 315 | | |
306 | 316 | | |
307 | | - | |
| 317 | + | |
308 | 318 | | |
309 | 319 | | |
310 | 320 | | |
| |||
340 | 350 | | |
341 | 351 | | |
342 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
343 | 363 | | |
344 | 364 | | |
345 | 365 | | |
| |||
353 | 373 | | |
354 | 374 | | |
355 | 375 | | |
356 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
357 | 381 | | |
358 | 382 | | |
359 | 383 | | |
360 | | - | |
| 384 | + | |
361 | 385 | | |
362 | 386 | | |
363 | 387 | | |
| |||
0 commit comments