Commit 9e605b3
authored
Create a specialized pool for arrays of ClassifiedSpanInternal (#11925)
Create a specialized pool for arrays of ClassifiedSpanInternal
These arrays show up as a fairly large allocation in the typing scenario
of the razor speedometer test. There are 150 MB (2.1%)of allocations of
ClassifiedSpanInternal[] in the profile, but only 2.1 MB of
ImmutableArray<ClassifiedSpanInternal>. This should be partly addressed
by the earlier switch from DrainToImmutable use ToImmutableAndClear.
However, this is also indicative that the 512 entry threshold for
ArrayBuilderPool isn't sufficient for ClassifiedSpanInternal array
counts. Roslyn has experienced this too and utilizes separate array
pools for classification/tagging performance. The new pool has a
threshold of 16K, much larger than the 512 entry limit. I tested this
against a 60 KB razor file and was hitting about 7K entries, so this
seemed like a pretty reasonable value. To ensure this doesn't add to
total memory usage, the pool is limited to only 5 entries, as
cconcurrent execution of classification isn't common.

...
File tree
1 file changed
+32
-1
lines changed- src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language
1 file changed
+32
-1
lines changedLines changed: 32 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
54 | | - | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
366 | 397 | | |
0 commit comments