Commit 978be80
authored
Reduce pooled array allocations in the SyntaxParser (#76610)
These pooled array allocations are showing up in the roslyn editing speedometer test as 2.9% of allocations in the code analysis process.
The SyntaxParser has pools for holding the BlendedNode and SyntaxToken arrays it uses. However, it sets the size of the pool to be only 2 items. As these arrays are only released once the parser is disposed, and there are potentially quite a few concurrent parses going on during solution load, there ends up being quite a few allocations of these arrays due to earlier allocations not yet being released to the pool.
Instead, just switch these object pools to use the default for the array size.
Local testing for opening the Roslyn sln showed about 50K SyntaxParser objects constructed, and I was seeing the blended/token arrays allocated 3.5K/10.5K respectively. With this change, I saw those array allocations reduced to 18/54 respectively. Will create a test insertion to get speedometer numbers.1 parent 77df282 commit 978be80
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments