dotnet / dotnet/runtime

[RuntimeAsync] R2R code size

Open
#125,541 5 comments 0 reactions 1 assignee Claimed by @jakobbotsch View on GitHub
area-CodeGen-coreclr runtime-async tenet-performance
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

R2R analogue to https://github.com/dotnet/runtime/issues/125148

Looking at the sizes of libraries in IL compared to R2R compiled, we see that including the native codegen often partially nullifies the size benefit of runtime-async.

Notably, in some cases like `System.Net.Http.dll`, `System.Private.Xml.Linq.dll`, and `System.Linq.AsyncEnumerable.dll`, the absolute decrease in size from async v1 to async v2 is less for R2R compiled assemblies, (potentially) meaning that the codegen is actually larger for async v2 than v1, and the R2R savings are all from smaller IL.

```
Library IL Diff IL % R2R Diff R2R % R2R−IL %
-----------------------------------------------------------------------------------------------------------
System.Net.Mail.dll -26,624 -13.68% -79,872 -14.79% -1.10% ▲
System.IO.Compression.dll -46,592 -23.64% -60,928 -12.11% + 11.53% ▽
System.IO.Compression.ZipFile.dll -9,728 -22.09% -9,728 -10.73% + 11.36% ▽
System.Net.Security.dll -38,400 -11.42% -77,824 -9.53% + 1.89% ▽
System.Formats.Tar.dll -23,040 -20.55% -24,576 -9.21% + 11.33% ▽
System.Linq.AsyncEnumerable.dll -98,816 -22.08% -91,648 -6.93% + 15.16% ▽
System.Net.Http.dll -104,960 -15.84% -103,424 -6.01% + 9.83% ▽
System.Private.Xml.Linq.dll -20,992 -14.49% -22,528 -5.90% + 8.59% ▽
System.Net.WebSockets.dll -14,336 -14.58% -13,312 -5.87% + 8.71% ▽
System.Net.Ping.dll -4,096 -8.99% -4,608 -4.84% + 4.15% ▽
System.Net.Http.Json.dll -7,680 -16.67% -5,120 -4.67% + 11.99% ▽
System.IO.Pipelines.dll -9,216 -13.53% -7,680 -4.48% + 9.06% ▽
System.IO.Compression.Brotli.dll -3,072 -9.84% -2,048 -3.15% + 6.69% ▽
System.Private.Xml.dll -259,072 -8.37% -241,152 -3.05% + 5.32% ▽
System.Threading.Tasks.Parallel.dll -3,072 -5.94% -2,560 -2.28% + 3.66% ▽
System.Net.ServerSentEvents.dll -2,048 -6.67% -1,024 -1.65% + 5.01% ▽
System.Net.Quic.dll -8,192 -5.06% -5,632 -1.64% + 3.43% ▽
System.Net.Requests.dll -6,144 -4.07% -5,632 -1.57% + 2.49% ▽
System.Threading.Tasks.Dataflow.dll -5,632 -3.20% -4,608 -1.00% + 2.20% ▽
System.Text.Json.dll -13,312 -2.07% -18,432 -0.97% + 1.09% ▽
System.Diagnostics.Process.dll -3,072 -2.52% -2,560 -0.95% + 1.57% ▽
System.IO.Pipes.dll -2,560 -4.42% -1,024 -0.87% + 3.56% ▽
System.Security.Cryptography.dll -15,360 -1.47% -21,504 -0.81% + 0.66% ▽
System.Net.WebSockets.Client.dll -2,048 -4.94% -512 -0.64% + 4.30% ▽
System.Net.Sockets.dll -7,680 -3.36% -3,584 -0.60% + 2.76% ▽
System.Net.HttpListener.dll -2,560 -2.09% -1,536 -0.54% + 1.55% ▽
System.Private.DataContractSerialization.dll -12,800 -1.51% -8,704 -0.42% + 1.09% ▽
System.Data.Common.dll -8,704 -0.86% -8,192 -0.29% + 0.57% ▽
System.Collections.dll + 512 + 0.50% 0 0.00% -0.50% ▽
System.IO.IsolatedStorage.dll + 512 + 1.54% 0 0.00% -1.54% ▽
System.Net.NetworkInformation.dll -1,024 -1.23% 0 0.00% + 1.23% ▽
System.Resources.Writer.dll + 512 + 3.12% 0 0.00% -3.12% ▽
System.Runtime.InteropServices.JavaScript.dll + 512 + 1.82% 0 0.00% -1.82% ▽
System.Threading.AccessControl.dll + 512 + 2.22% 0 0.00% -2.22% ▽
System.Xml.XPath.XDocument.dll + 512 + 9.09% 0 0.00% -9.09% ▽
System.Transactions.Local.dll 0 0.00% + 512 + 0.15% + 0.15% ▽
System.Private.Uri.dll 0 0.00% + 512 + 0.22% + 0.22% ▽
System.Net.Primitives.dll 0 0.00% + 512 + 0.24% + 0.24% ▽
System.Collections.Concurrent.dll 0 0.00% + 512 + 0.42% + 0.42% ▽
System.IO.FileSystem.Watcher.dll -1,024 -1.90% + 512 + 0.45% + 2.36% ▽
System.Net.WebClient.dll -512 -0.85% + 1,024 + 0.70% + 1.55% ▽
System.Threading.Channels.dll -1,536 -2.73% + 1,024 + 0.74% + 3.46% ▽
System.Reflection.DispatchProxy.dll 0 0.00% + 512 + 0.90% + 0.90% ▽
System.Security.AccessControl.dll 0 0.00% + 512 + 1.05% + 1.05% ▽
System.Runtime.Serialization.dll + 512 + 7.69% + 512 + 7.69% 0.00%
System.Security.Cryptography.X509Certificates.dll + 512 + 7.69% + 512 + 7.69% 0.00%
System.Security.Cryptography.Csp.dll + 512 + 9.09% + 512 + 9.09% 0.00%
System.Xml.XDocument.dll + 512 + 9.09% + 512 + 9.09% 0.00%
Microsoft.Win32.Primitives.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.Globalization.Extensions.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.IO.FileSystem.Primitives.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.IO.UnmanagedMemoryStream.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.Runtime.Handles.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.Runtime.InteropServices.RuntimeInformation.dll + 512 + 10.00% + 512 + 10.00% 0.00%
System.Security.SecureString.dll + 512 + 10.00% + 512 + 10.00% 0.00%
-----------------------------------------------------------------------------------------------------------

Summary:
IL total delta: -4.33%
R2R total delta: -1.84%
Shift: +2.50% (R2R dampens the overall difference)

▲ R2R amplifies difference: 1 libraries
▽ R2R dampens difference: 43 libraries
Neutral (<0.05%): 11 libraries
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.