Skip to content

Automagically remove F# compilation resources #329

Open
@dsyme

Description

@dsyme

The linker can/should automatically remove any .NET manifest assembly resources named FSharpSignatureData.* and FSharpOptimizationData.* during linking.

These are only ever needed for F# compilation which doesn't happen on-device and given the aims of the linker it is reasonable to assume this data is unreachable.

My understanding is that removing these would trim about 1.5MB off the size of all applications using FSharp.Core.dll, and about 3MB off all applications using Elmish.XamarinForms.dll.

Here's an example of how the resources look in ILDASM:

    .mresource public FSharpSignatureData.Elmish.XamarinForms
    .mresource public FSharpOptimizationData.Elmish.XamarinForms

Thanks

Activity

nosami

nosami commented on Jul 3, 2018

@nosami

I think we need an option to preserve the resources as @praeclarum's Continuous IDE does do F# compilation on device.

That's the only app that I am aware of that might break.

dsyme

dsyme commented on Jul 3, 2018

@dsyme
Author

Yes. I'm still amazed that works. We could recommend that that app bundle a private copy of FSharp.Core but I'm also ok with there being an appropriate option

radekdoulik

radekdoulik commented on Jul 3, 2018

@radekdoulik
Member

We can extend the custom linker xml definition to be able to preserve resources as well and remove these by default

self-assigned this
on Jul 3, 2018
Numpsy

Numpsy commented on Apr 24, 2025

@Numpsy

Question: Could/Should this linker functionality be extended to strip the new compressed equivalents of these resources (which have different names?)

refs dotnet/fsharp#15605 dotnet/fsharp#17995

T-Gro

T-Gro commented on Apr 28, 2025

@T-Gro
Member

Yes, it should.
The names which can appear in a F# assembly are:

FSharpSignatureData.*
FSharpSignatureDataB.*
FSharpSignatureCompressedData.*
FSharpSignatureCompressedDataB.*

FSharpOptimizationData.*
FSharpOptimizationDataB.*
FSharpOptimizationCompressedData.*
FSharpOptimizationCompressedDataB.*

FSharpOptimizationInfo.*
FSharpSignatureInfo.*
[the last 2 can only ever appear on FSharp.Core and has a different name for historical backwards compat reason, but then also FSharp.Core is what will be present in all compilation units]

reopened this on Apr 28, 2025
T-Gro

T-Gro commented on Apr 28, 2025

@T-Gro
Member

x.StartsWith("FSharpSignature") || x.StartsWith("FSharpOptimization")

Should cover all 10 possibilities.

1 remaining item

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @marek-safar@nosami@Numpsy@radekdoulik@dsyme

      Issue actions

        Automagically remove F# compilation resources · Issue #329 · dotnet/linker