Skip to content

Instantly share code, notes, and snippets.

@enricosada
Last active May 23, 2017 23:30
Show Gist options
  • Save enricosada/6d256c9986067e4b6e075fe3adc6fa2b to your computer and use it in GitHub Desktop.
Save enricosada/6d256c9986067e4b6e075fe3adc6fa2b to your computer and use it in GitHub Desktop.

Comparison between netstandard1.6 and netstandard2.0 for FSharp.Core

NOTE i have the .net core sdk 1.0 installed, and lots of previous NETStandard.Library packages in global nuget cache. This may impact or not (dotnetcli fill the cache anyway at first use). need to test a clean install too, to check same download size apply (ihmo important for CI/first use/etc), but maybe is not important***

.net sdk used 2.0.0-preview1-005899

To minimize differences, i used a normal C# console app and added FSharp.Core as package reference

This is also a normal scenario, when a C# project use an F# library

So both are netcoreapp2.0:

  • cs_ex1: dotnet new console
  • cs_ex2: dotnet new console + dotnet add package FSharp.Core --version 4.1.17

Normal

Restore

Restore using default nuget client, using a packages directory.

NOTE I didnt checked yet with paket, but there issue afaik is bigger because it download all packages, not using directly from bundled caches, so at least are some big file copy afaik. I'll update this with paket scenario*

dotnet restore --packages packages

Using fsharp.core (cs_ex2 has 4 more deps, the ones outside NETStandard.Library)

CS_EX1 CS_EX2
fsharp.core
system.net.requests
system.threading.tasks.parallel
system.net.webheadercollection

Build

dotnet build -v n

Multiple infos about package conflicts, but because FSharp.Core deps are a bit old (june 2016 instead of november 2016). These are shown only with verbosity >= normal (but that's usually the default on CI):

       _HandlePackageFileConflicts:
         Encountered conflict between 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Collections.dll' and 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\system.collections\4.0.11\ref\netstandard1.3\System.Collections.dll'.  Choosing 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Collections.dll' because AssemblyVersion '4.1.0.0' is greater than '4.0.10.0'.
         Encountered conflict between 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Collections.Concurrent.dll' and 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\system.collections.concurrent\4.0.12\ref\netstandard1.3\System.Collections.Concurrent.dll'.  Choosing 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Collections.Concurrent.dll' because AssemblyVersion '4.0.14.0' is greater than '4.0.10.0'.
         Encountered conflict between 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Console.dll' and 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\system.console\4.0.0\ref\netstandard1.3\System.Console.dll'.  Choosing 'Reference:C:\Users\e.sada\.dotnet\NuGetFallbackFolder\microsoft.netcore.app\2.0.0-preview1-002101-00\ref\netcoreapp2.0\System.Console.dll' because AssemblyVersion '4.1.0.0' is greater than '4.0.0.0'.

Other 60 omitted

Publish as FDD

Just the .deps.json contains more info about the packages.

Publish as SCD

this require re-restore with for a specific runtime

  • dotnet restore --packages packages -r win10-x64

Without using FSharp.Core (the cs_ex1) is:

runtime.win-x64.microsoft.netcore.app
runtime.win-x64.microsoft.netcore.dotnetapphost
runtime.win-x64.microsoft.netcore.dotnethostpolicy
runtime.win-x64.microsoft.netcore.dotnethostresolver

Instead when using FSharp.Core will create more packages

fsharp.core
runtime.any.system.collections
runtime.any.system.diagnostics.tools
runtime.any.system.diagnostics.tracing
runtime.any.system.globalization
runtime.any.system.globalization.calendars
runtime.any.system.io
runtime.any.system.reflection
runtime.any.system.reflection.extensions
runtime.any.system.reflection.primitives
runtime.any.system.resources.resourcemanager
runtime.any.system.runtime
runtime.any.system.runtime.handles
runtime.any.system.runtime.interopservices
runtime.any.system.text.encoding
runtime.any.system.text.encoding.extensions
runtime.any.system.threading.tasks
runtime.any.system.threading.timer
runtime.win-x64.microsoft.netcore.app
runtime.win-x64.microsoft.netcore.dotnetapphost
runtime.win-x64.microsoft.netcore.dotnethostpolicy
runtime.win-x64.microsoft.netcore.dotnethostresolver
runtime.win.microsoft.win32.primitives
runtime.win.system.console
runtime.win.system.diagnostics.debug
runtime.win.system.io.filesystem
runtime.win.system.net.primitives
runtime.win.system.runtime.extensions
runtime.win7.system.private.uri
system.net.requests
system.net.webheadercollection
system.private.uri
system.threading.overlapped
system.threading.tasks.parallel

While the total size is 120MB, the difference betwen (cs_ex1 and cs_ex2), excluded FSharp.Core and runtime.win-x64.microsoft.netcore.*, in file size is minimal ( 9MB ).

And after dotnet publish --self-contained -r win10-x64 to publish as SDC, there are no differences.

NOTES

The remaining packages seems contained in netstandard2.0 closure.

I tried to diff the deps not in netstandard.library, using SurfaceArea.coreclr.fs and seems these packages are useless now in netstandard2.0 (i may be wrong) Ref the diff 1.6-2.0

  • system.net.requests
    • System.Net.WebClient back

Used in these missing from coreclr surface atm

Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[Microsoft.FSharp.Core.Unit] AsyncDownloadFile(System.Net.WebClient, System.Uri, System.String)
Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Byte[]] AsyncDownloadData(System.Net.WebClient, System.Uri)
Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.String] AsyncDownloadString(System.Net.WebClient, System.Uri)

The system.threading.tasks.parallel, system.net.webheadercollection both are back in netstandard2.0.

Conclusion

Using normal nuget client in sdk2.0 has no big impact in download atm (dunno if additional runtimes are bigger in others os, but doesnt matter)

Probably will impact paket more, i'll check and update this

Probably is possibile to remove these non NETStandard.Library packages and use netstandard2.0 directly, leaving FSharp.core with no other deps in netstandard2.0 and a slighly bitter surface area

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