diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-11-15 12:54:06 -0500 |
---|---|---|
committer | Stephen Toub <stoub@microsoft.com> | 2017-11-18 17:58:51 -0500 |
commit | 7f0eb6109c8572e15c5a263c864f53fb2442baf3 (patch) | |
tree | 03b3eeaecd5f332eb82da41100f1285a8188341b /src/mscorlib/shared/System.Private.CoreLib.Shared.projitems | |
parent | 64a1fd6e3d5e6d44b643d02671521aa3e71e7ec8 (diff) | |
download | coreclr-7f0eb6109c8572e15c5a263c864f53fb2442baf3.tar.gz coreclr-7f0eb6109c8572e15c5a263c864f53fb2442baf3.tar.bz2 coreclr-7f0eb6109c8572e15c5a263c864f53fb2442baf3.zip |
Improve performance of managed formatting code
- Optimize NumberBuffer passing by reference instead of value. It's a large struct of ~50 bytes; copying it around has non-trivial cost.
- Replace formatting StringBuilder with ref struct and stack allocation. Avoids lots of allocation and associated throughput costs.
- Improve perf of 'D' formatting of 32-bit and 64-bit integers.
- Remove array allocations accessing NumberFormatInfo props.
- Accessing array properties like PercentGroupSizes clones the corresponding field. That's unnecessary here, as we don't mutate the array.
- Remove int[] allocation from NumberToStringFormat. Span makes it easy to start with stack space and grow to an allocated array as needed.
- Improve perf of hex formatting of integers. Including removing some sizable allocations.
- Manually inline several hot functions called in only one place.
- Tweak some range comparisons in ParseFormatSpecifier.
- Avoid large stackallocs in NumberToString{Fixed}. It's incurring non-trivial overheads.
- Tweak perf of ValueStringBuilder. In particular, make Append(string) faster for the single-char case, which is extremely common in integer formatting due to its prevalence in strings in NumberFormatInfo.
Diffstat (limited to 'src/mscorlib/shared/System.Private.CoreLib.Shared.projitems')
-rw-r--r-- | src/mscorlib/shared/System.Private.CoreLib.Shared.projitems | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index 5f3e4d2ce8..79b9dca063 100644 --- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -479,6 +479,7 @@ <Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF32Encoding.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF7Encoding.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF8Encoding.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)System\Text\ValueStringBuilder.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\TimeSpan.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\ThreadAttributes.cs" /> <Compile Include="$(MSBuildThisFileDirectory)System\Threading\AbandonedMutexException.cs" /> |