Skip to content

NAOT publish build has a 1MB size delta between reflection free and not (+50% total size) #82607

@Sergio0694

Description

@Sergio0694

Description

I've tried out .NET 8 Preview 1 for my NAOT sample for ComputeSharp (https://github.com/Sergio0694/ComputeSharp), and noticed that the size delta between reflection free and now is particularly large, more than expected (talking with @MichalStrehovsky he mentioned he would've expected the different to be 3-400 KB).

Note: I am already enabling all size saving options on top of reflection free, to make the comparison fair (source):

<PropertyGroup Condition="'$(COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT)' == 'true'">
  <PublishAot>true</PublishAot>
  <UseSystemResourceKeys>true</UseSystemResourceKeys>
  <InvariantGlobalization>true</InvariantGlobalization>
  <IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
  <IlcDisableReflection>true</IlcDisableReflection>
  <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
</PropertyGroup>

IlcOptimizationPreference is set to Speed since the delta for that one is just ~50 KB, so not worth it in this scenario.

FYI @MichalStrehovsky @agocke

Reproduction Steps

$env:COMPUTESHARP_SWAPCHAIN_CLI_PUBLISH_AOT='true';
dotnet publish samples\ComputeSharp.SwapChain.Cli\ComputeSharp.SwapChain.Cli.csproj -r win-x64

Expected behavior

The delta between reflection enabled and reflection free should be around smaller.

Actual behavior

I get these results:

  • Reflection free: 1.892 KB
  • Reflection enabled: 2.821 KB

That's a 929 KB difference (+49.1%).

Other information

Here's the two .map.xml files for both configurations: computesharp.cli.reflection.map.zip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions