Commit 8aba1f2
authored
Reduce allocations in ChecksumUtilities.BytesToString (#12359)
* Reduce allocations in ChecksumUtilities.BytesToString
This method was previously allocating a string for each byte being converted and then allocating another string for the stringbuilder.ToString call. Instead:
if >NET9
use Convert.ToHexStringLower
else
create stack alloc'ed char[] and put converted chars in there and allocate a single string from that1 parent 90444a4 commit 8aba1f2
File tree
1 file changed
+15
-10
lines changed- src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language
1 file changed
+15
-10
lines changedLines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
| |||
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
24 | 22 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
0 commit comments