Commit abcb361
authored
Cache the compilation states in compilation order to avoid recalculation (#76380)
Cache the compilation states in compilation order to avoid recalculation
GetStatesInCompilationOrder shows up pretty heavily in CPU usage in the typing scenario in the csharp editing speedometer. The enumerating of the ImmutableList and the repeated searching in the ImmutableSortedDictionary are actually more expensive than one would think.
GetStatesInCompilationOrder is optimized out of the profile, but it looks like it is accounting for about 5% of CPU.
I'm going to run a test insertion with this change and see what the CPU/memory delta of this method looks like with this change.1 parent 80b91e9 commit abcb361
File tree
2 files changed
+22
-3
lines changed- src
- Compilers/Core/Portable/InternalUtilities
- Workspaces/Core/Portable/Workspace/Solution
2 files changed
+22
-3
lines changedLines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
400 | 416 | | |
401 | 417 | | |
402 | 418 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
120 | | - | |
| 121 | + | |
121 | 122 | | |
122 | | - | |
123 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
124 | 127 | | |
125 | 128 | | |
126 | 129 | | |
| |||
0 commit comments