From e0d629a972cdb0cd2d093f77119f0ec67f74fabd Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Sat, 30 May 2020 15:50:55 +0200 Subject: [PATCH] Create initial benchmark. (#878) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Create initial benchmark. * Fix path 😅 * Publish benchmark results to Azure * Add secret to env variables --- .github/workflows/main.yml | 1 + .gitignore | 3 +- build.fsx | 70 ++++++ build.fsx.lock | 213 ++++++++++++++++-- fantomas.sln | 14 ++ paket.dependencies | 3 + paket.lock | 80 +++++-- .../Fantomas.Benchmarks.fsproj | 16 ++ src/Fantomas.Benchmarks/Program.fs | 8 + src/Fantomas.Benchmarks/Runners.fs | 24 ++ src/Fantomas.Benchmarks/paket.references | 3 + 11 files changed, 406 insertions(+), 29 deletions(-) create mode 100644 src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj create mode 100644 src/Fantomas.Benchmarks/Program.fs create mode 100644 src/Fantomas.Benchmarks/Runners.fs create mode 100644 src/Fantomas.Benchmarks/paket.references diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31c15723b8..eea6c66159 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,7 @@ jobs: run: dotnet fake run build.fsx env: CI: true + TABLE_STORAGE_CONNECTION_STRING: ${{ secrets.TABLE_STORAGE_CONNECTION_STRING }} - name: "trigger fantomas-ui pipeline" if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' run: curl -X POST -F token=${{secrets.FANTOMAS_UI_TOKEN}} -F ref=preview -F "variables[TRIGGER]=true" https://gitlab.com/api/v4/projects/8920076/trigger/pipeline diff --git a/.gitignore b/.gitignore index 9362030236..bb835bf9d2 100644 --- a/.gitignore +++ b/.gitignore @@ -185,4 +185,5 @@ external-project-tests/ .paket/paket.exe .fake/ .vscode/ -.ionide \ No newline at end of file +.ionide +BenchmarkDotNet.Artifacts/ \ No newline at end of file diff --git a/build.fsx b/build.fsx index 248291bc9f..3b43c9b2d1 100644 --- a/build.fsx +++ b/build.fsx @@ -1,4 +1,8 @@ + +open Fake.Core + #r "paket: +nuget Microsoft.Azure.Cosmos.Table nuget Fake.BuildServer.AppVeyor nuget Fake.Core.ReleaseNotes nuget Fake.Core.Xml @@ -15,6 +19,7 @@ nuget Fake.Core.Target //" open Fake.Core open Fake.IO +open Fake.IO.FileSystemOperators open Fake.Core.TargetOperators open Fake.BuildServer open System @@ -346,6 +351,70 @@ Target.create "MyGet" (fun _ -> pushPackage args ) +let git command = + CreateProcess.fromRawCommandLine "git" command + |> CreateProcess.redirectOutput + |> Proc.run + |> fun p -> p.Result.Output.Trim() + +open Microsoft.Azure.Cosmos.Table +open Microsoft.Azure.Documents + +Target.create "Benchmark" (fun _ -> + DotNet.exec id ("src" "Fantomas.Benchmarks" "bin" "Release" "netcoreapp3.1" "Fantomas.Benchmarks.dll") "" + |> ignore + + match Environment.environVarOrNone "TABLE_STORAGE_CONNECTION_STRING" with + | Some conn -> + let branchName = git "rev-parse --abbrev-ref HEAD" + let commit = git "rev-parse HEAD" + let operatingSystem = Environment.environVar "RUNNER_OS" + + let results = + System.IO.File.ReadLines("./BenchmarkDotNet.Artifacts/results/Fantomas.Benchmarks.Runners.CodePrinterTest-report.csv") + |> Seq.map (fun line -> line.Split(',') |> Array.toList) + |> Seq.toList + |> fun lineGroups -> + match lineGroups with + | [ header; values ] -> + let csvValues = List.zip header values + + let buildNumber = + match buildNumber with + |Some i -> [ "BuildNumber", i.ToString() ] + | None -> [] + + let metaData = + [ "Branch", branchName + "Commit", commit + "Operating System", operatingSystem + yield! buildNumber ] + + [ yield! csvValues; yield! metaData ] + | _ -> + [] + + let storageAccount = CloudStorageAccount.Parse(conn) + let tableClient = storageAccount.CreateCloudTableClient() + let table = tableClient.GetTableReference("FantomasBenchmarks") + let entry = DynamicTableEntity() + entry.PartitionKey <- "GithubActions" + entry.RowKey <- (sprintf "%s|%s|%s" branchName commit operatingSystem).ToLower() + + results + |> List.iter (fun (k,v) -> + let key = k.Replace(' ','_') + if not (isNull v) then + entry.Properties.Add(key, EntityProperty.CreateEntityPropertyFromObject(v))) + + let tableOperation = TableOperation.InsertOrReplace(entry) + + table.Execute(tableOperation) + |> printfn "%O" + | None -> + printfn "Not saving benchmark results to the cloud" +) + // -------------------------------------------------------------------------------------- // Run all targets by default. Invoke 'build ' to override @@ -355,6 +424,7 @@ Target.create "All" ignore ==> "ProjectVersion" ==> "Build" ==> "UnitTests" + ==> "Benchmark" ==> "Pack" ==> "All" ==> "Push" diff --git a/build.fsx.lock b/build.fsx.lock index dc4438c27e..ac787b12a2 100644 --- a/build.fsx.lock +++ b/build.fsx.lock @@ -114,10 +114,31 @@ NUGET FSharp.Core (>= 4.7.1) FParsec (1.1.1) FSharp.Core (>= 4.3.4) - FSharp.Control.Reactive (4.2) - FSharp.Core (>= 4.2.3) - System.Reactive (>= 4.0) - FSharp.Core (4.7.1) + FSharp.Control.Reactive (4.3) + FSharp.Core (>= 4.7) + System.Reactive (>= 4.3.2) + FSharp.Core (4.7.2) + Microsoft.Azure.Cosmos.Table (1.0.7) + Microsoft.Azure.DocumentDB.Core (>= 2.10) + Microsoft.OData.Core (>= 7.5) + Newtonsoft.Json (>= 10.0.2) + Microsoft.Azure.DocumentDB.Core (2.10.3) + NETStandard.Library (>= 1.6) + Newtonsoft.Json (>= 9.0.1) + System.Collections.Immutable (>= 1.3) + System.Collections.NonGeneric (>= 4.0.1) + System.Collections.Specialized (>= 4.0.1) + System.Diagnostics.TraceSource (>= 4.0) + System.Dynamic.Runtime (>= 4.0.11) + System.Linq.Queryable (>= 4.0.1) + System.Net.Http (>= 4.3.4) + System.Net.NameResolution (>= 4.0) + System.Net.NetworkInformation (>= 4.1) + System.Net.Requests (>= 4.0.11) + System.Net.Security (>= 4.3.2) + System.Net.WebHeaderCollection (>= 4.0.1) + System.Runtime.Serialization.Primitives (>= 4.1.1) + System.Security.SecureString (>= 4.0) Microsoft.Build (16.5) Microsoft.Build.Framework (16.5) System.Runtime.Serialization.Primitives (>= 4.1.1) @@ -142,6 +163,11 @@ NUGET System.Text.Encoding.CodePages (>= 4.0.1) Microsoft.NETCore.Platforms (3.1.1) Microsoft.NETCore.Targets (3.1) + Microsoft.OData.Core (7.6.4) + Microsoft.OData.Edm (7.6.4) + Microsoft.Spatial (7.6.4) + Microsoft.OData.Edm (7.6.4) + Microsoft.Spatial (7.6.4) Microsoft.Win32.Primitives (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -158,24 +184,26 @@ NUGET Microsoft.Build.Tasks.Core (>= 16.4) Microsoft.Build.Utilities.Core (>= 16.4) System.IO.Compression (>= 4.3) + NETStandard.Library (2.0.3) + Microsoft.NETCore.Platforms (>= 1.1) Newtonsoft.Json (12.0.3) - NuGet.Common (5.5.1) - NuGet.Frameworks (>= 5.5.1) + NuGet.Common (5.6) + NuGet.Frameworks (>= 5.6) System.Diagnostics.Process (>= 4.3) System.Threading.Thread (>= 4.3) - NuGet.Configuration (5.5.1) - NuGet.Common (>= 5.5.1) + NuGet.Configuration (5.6) + NuGet.Common (>= 5.6) System.Security.Cryptography.ProtectedData (>= 4.3) - NuGet.Frameworks (5.5.1) - NuGet.Packaging (5.5.1) + NuGet.Frameworks (5.6) + NuGet.Packaging (5.6) Newtonsoft.Json (>= 9.0.1) - NuGet.Configuration (>= 5.5.1) - NuGet.Versioning (>= 5.5.1) + NuGet.Configuration (>= 5.6) + NuGet.Versioning (>= 5.6) System.Dynamic.Runtime (>= 4.3) - NuGet.Protocol (5.5.1) - NuGet.Packaging (>= 5.5.1) + NuGet.Protocol (5.6) + NuGet.Packaging (>= 5.6) System.Dynamic.Runtime (>= 4.3) - NuGet.Versioning (5.5.1) + NuGet.Versioning (5.6) runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) @@ -191,6 +219,9 @@ NUGET runtime.native.System.Net.Http (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) + runtime.native.System.Net.Security (4.3.1) + Microsoft.NETCore.Platforms (>= 1.1.1) + Microsoft.NETCore.Targets (>= 1.1.3) runtime.native.System.Security.Cryptography.Apple (4.3.1) runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) @@ -238,6 +269,21 @@ NUGET System.Threading.Tasks (>= 4.3) System.Collections.Immutable (1.7.1) System.Memory (>= 4.5.4) + System.Collections.NonGeneric (4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) + System.Collections.Specialized (4.3) + System.Collections.NonGeneric (>= 4.3) + System.Globalization (>= 4.3) + System.Globalization.Extensions (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) System.Diagnostics.Debug (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -266,6 +312,16 @@ NUGET System.Threading.Tasks (>= 4.3) System.Threading.Thread (>= 4.3) System.Threading.ThreadPool (>= 4.3) + System.Diagnostics.TraceSource (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Globalization (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Threading (>= 4.3) System.Diagnostics.Tracing (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -369,6 +425,15 @@ NUGET System.Runtime.Extensions (>= 4.3) System.Threading (>= 4.3) System.Threading.Tasks (>= 4.3) + System.Linq.Queryable (4.3) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Linq (>= 4.3) + System.Linq.Expressions (>= 4.3) + System.Reflection (>= 4.3) + System.Reflection.Extensions (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) System.Memory (4.5.4) System.Buffers (>= 4.5.1) System.Numerics.Vectors (>= 4.4) @@ -400,11 +465,105 @@ NUGET System.Text.Encoding (>= 4.3) System.Threading (>= 4.3) System.Threading.Tasks (>= 4.3) + System.Net.NameResolution (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Principal.Windows (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Net.NetworkInformation (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + runtime.native.System (>= 4.3) + System.Collections (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.IO.FileSystem (>= 4.3) + System.IO.FileSystem.Primitives (>= 4.3) + System.Linq (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Net.Sockets (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Principal.Windows (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Overlapped (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.Thread (>= 4.3) + System.Threading.ThreadPool (>= 4.3) System.Net.Primitives (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) System.Runtime (>= 4.3.1) System.Runtime.Handles (>= 4.3) + System.Net.Requests (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Collections (>= 4.3) + System.Diagnostics.Debug (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Net.Http (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Net.WebHeaderCollection (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Net.Security (4.3.2) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.Win32.Primitives (>= 4.3) + runtime.native.System (>= 4.3) + runtime.native.System.Net.Security (>= 4.3) + runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) + System.Collections (>= 4.3) + System.Collections.Concurrent (>= 4.3) + System.Diagnostics.Tracing (>= 4.3) + System.Globalization (>= 4.3) + System.Globalization.Extensions (>= 4.3) + System.IO (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Claims (>= 4.3) + System.Security.Cryptography.Algorithms (>= 4.3) + System.Security.Cryptography.Encoding (>= 4.3) + System.Security.Cryptography.OpenSsl (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Security.Cryptography.X509Certificates (>= 4.3) + System.Security.Principal (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Threading.ThreadPool (>= 4.3) + System.Net.Sockets (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + Microsoft.NETCore.Targets (>= 1.1) + System.IO (>= 4.3) + System.Net.Primitives (>= 4.3) + System.Runtime (>= 4.3) + System.Threading.Tasks (>= 4.3) + System.Net.WebHeaderCollection (4.3) + System.Collections (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) System.Numerics.Vectors (4.5) System.ObjectModel (4.3) System.Collections (>= 4.3) @@ -484,6 +643,14 @@ NUGET System.Runtime (>= 4.3) System.Security.AccessControl (4.7) System.Security.Principal.Windows (>= 4.7) + System.Security.Claims (4.3) + System.Collections (>= 4.3) + System.Globalization (>= 4.3) + System.IO (>= 4.3) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Extensions (>= 4.3) + System.Security.Principal (>= 4.3) System.Security.Cryptography.Algorithms (4.3.1) Microsoft.NETCore.Platforms (>= 1.1) runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) @@ -564,7 +731,18 @@ NUGET System.Security.Cryptography.Primitives (>= 4.3) System.Text.Encoding (>= 4.3) System.Threading (>= 4.3) + System.Security.Principal (4.3) + System.Runtime (>= 4.3) System.Security.Principal.Windows (4.7) + System.Security.SecureString (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) + System.Runtime.InteropServices (>= 4.3) + System.Security.Cryptography.Primitives (>= 4.3) + System.Text.Encoding (>= 4.3) + System.Threading (>= 4.3) System.Text.Encoding (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -579,6 +757,11 @@ NUGET System.Threading (4.3) System.Runtime (>= 4.3) System.Threading.Tasks (>= 4.3) + System.Threading.Overlapped (4.3) + Microsoft.NETCore.Platforms (>= 1.1) + System.Resources.ResourceManager (>= 4.3) + System.Runtime (>= 4.3) + System.Runtime.Handles (>= 4.3) System.Threading.Tasks (4.3) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) diff --git a/fantomas.sln b/fantomas.sln index e719f5fe83..f4781bb2aa 100644 --- a/fantomas.sln +++ b/fantomas.sln @@ -16,6 +16,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fantomas.CoreGlobalTool", " EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fantomas.CoreGlobalTool.Tests", "src\Fantomas.CoreGlobalTool.Tests\Fantomas.CoreGlobalTool.Tests.fsproj", "{DEDE6968-0BE8-4415-9262-8355B82AF2C0}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fantomas.Benchmarks", "src\Fantomas.Benchmarks\Fantomas.Benchmarks.fsproj", "{B6BC63D5-410D-4DBB-9D45-5638F20BD09B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -77,6 +79,18 @@ Global {DEDE6968-0BE8-4415-9262-8355B82AF2C0}.Release|x64.Build.0 = Release|Any CPU {DEDE6968-0BE8-4415-9262-8355B82AF2C0}.Release|x86.ActiveCfg = Release|Any CPU {DEDE6968-0BE8-4415-9262-8355B82AF2C0}.Release|x86.Build.0 = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|x64.ActiveCfg = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|x64.Build.0 = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Debug|x86.Build.0 = Debug|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|Any CPU.Build.0 = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|x64.ActiveCfg = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|x64.Build.0 = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|x86.ActiveCfg = Release|Any CPU + {B6BC63D5-410D-4DBB-9D45-5638F20BD09B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution EndGlobalSection diff --git a/paket.dependencies b/paket.dependencies index ac45eb7690..25b65fe111 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -11,3 +11,6 @@ nuget nunit 3.12.0 nuget NUnit3TestAdapter 3.15.1 nuget NunitXml.TestLogger nuget Argu +nuget BenchmarkDotNet + +github: fsprojects/fantomas:829faa6ba834f99afed9b4434b3a1680536474b2 src/Fantomas/CodePrinter.fs \ No newline at end of file diff --git a/paket.lock b/paket.lock index c8ad17efe2..6802a9cc92 100644 --- a/paket.lock +++ b/paket.lock @@ -5,6 +5,24 @@ NUGET Argu (6.0) FSharp.Core (>= 4.3.2) System.Configuration.ConfigurationManager (>= 4.4) + BenchmarkDotNet (0.12.1) + BenchmarkDotNet.Annotations (>= 0.12.1) + CommandLineParser (>= 2.4.3) + Iced (>= 1.4) + Microsoft.CodeAnalysis.CSharp (>= 2.10) + Microsoft.Diagnostics.NETCore.Client (>= 0.2.61701) + Microsoft.Diagnostics.Runtime (>= 1.1.57604) + Microsoft.Diagnostics.Tracing.TraceEvent (>= 2.0.49) + Microsoft.DotNet.PlatformAbstractions (>= 2.1) + Microsoft.Win32.Registry (>= 4.5) + Perfolizer (>= 0.2.1) + System.Management (>= 4.5) + System.Reflection.Emit (>= 4.3) + System.Reflection.Emit.Lightweight (>= 4.3) + System.Threading.Tasks.Extensions (>= 4.5.2) + System.ValueTuple (>= 4.5) + BenchmarkDotNet.Annotations (0.12.1) + CommandLineParser (2.8) FsCheck (2.14) FSharp.Core (>= 4.2.3) FSharp.Compiler.Service (35.0) @@ -21,7 +39,23 @@ NUGET FSharp.Core (>= 4.2.3) NETStandard.Library (>= 2.0.3) NUnit (>= 3.12 < 4.0) + Iced (1.7) + Microsoft.CodeAnalysis.Analyzers (3.0) + Microsoft.CodeAnalysis.Common (3.6) + Microsoft.CodeAnalysis.Analyzers (>= 3.0) + System.Collections.Immutable (>= 1.5) + System.Memory (>= 4.5.3) + System.Reflection.Metadata (>= 1.6) + System.Runtime.CompilerServices.Unsafe (>= 4.7) + System.Text.Encoding.CodePages (>= 4.5.1) + System.Threading.Tasks.Extensions (>= 4.5.3) + Microsoft.CodeAnalysis.CSharp (3.6) + Microsoft.CodeAnalysis.Common (3.6) Microsoft.CodeCoverage (16.5) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp2.1)) + Microsoft.Diagnostics.NETCore.Client (0.2.61701) + Microsoft.Diagnostics.Runtime (1.1.127808) + Microsoft.Diagnostics.Tracing.TraceEvent (2.0.56) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) Microsoft.DotNet.InternalAbstractions (1.0) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.AppContext (>= 4.1) System.Collections (>= 4.0.11) @@ -31,11 +65,12 @@ NUGET System.Runtime.Extensions (>= 4.1) System.Runtime.InteropServices (>= 4.1) System.Runtime.InteropServices.RuntimeInformation (>= 4.0) + Microsoft.DotNet.PlatformAbstractions (3.1.4) Microsoft.NET.Test.Sdk (16.4) Microsoft.CodeCoverage (>= 16.4) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp2.1)) Microsoft.TestPlatform.TestHost (>= 16.4) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.1)) Microsoft.NETCore.Platforms (3.1) - Microsoft.NETCore.Targets (3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + Microsoft.NETCore.Targets (3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp5.0)) Microsoft.TestPlatform.ObjectModel (16.5) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.1)) NuGet.Frameworks (>= 5.0) Microsoft.TestPlatform.TestHost (16.5) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.1)) @@ -45,7 +80,9 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) - Microsoft.Win32.Registry (4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + Microsoft.Win32.Registry (4.7) + System.Buffers (>= 4.5) - restriction: || (&& (== netcoreapp3.1) (>= monoandroid)) (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) + System.Memory (>= 4.5.3) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netcoreapp2.1)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) System.Security.AccessControl (>= 4.7) System.Security.Principal.Windows (>= 4.7) Microsoft.Win32.SystemEvents (4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.0)) @@ -67,12 +104,15 @@ NUGET System.Xml.XmlDocument (>= 4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.Xml.XPath.XmlDocument (>= 4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) NunitXml.TestLogger (2.1.41) + Perfolizer (0.2.1) + System.Memory (>= 4.5.3) runtime.native.System (4.3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) System.AppContext (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.Runtime (>= 4.3) System.Buffers (4.5) + System.CodeDom (4.7) System.Collections (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -187,10 +227,14 @@ NUGET System.Resources.ResourceManager (>= 4.3) System.Runtime (>= 4.3) System.Runtime.Extensions (>= 4.3) + System.Management (4.7) + Microsoft.NETCore.Platforms (>= 3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.0)) + Microsoft.Win32.Registry (>= 4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.0)) + System.CodeDom (>= 4.7) System.Memory (4.5.3) - System.Buffers (>= 4.4) - restriction: || (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) + System.Buffers (>= 4.4) - restriction: || (&& (== netcoreapp3.1) (>= monoandroid)) (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 4.5.2) - restriction: || (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netcoreapp2.1)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) - restriction: || (&& (== netcoreapp3.1) (>= monoandroid)) (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netcoreapp2.1)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) System.Numerics.Vectors (4.5) - restriction: || (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (== netstandard2.0) System.Reflection (4.3) Microsoft.NETCore.Platforms (>= 1.1) @@ -199,8 +243,10 @@ NUGET System.Reflection.Primitives (>= 4.3) System.Runtime (>= 4.3) System.Reflection.Emit (4.7) - System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0) (< netstandard2.1)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) - System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0) (< netstandard2.1)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) + System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0) (< netstandard2.1)) (&& (== netcoreapp3.1) (>= netcoreapp5.0)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) + System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0) (< netstandard2.1)) (&& (== netcoreapp3.1) (>= netcoreapp5.0)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (< portable-net45+wp8)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) + System.Reflection.Emit.Lightweight (4.7) + System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== netcoreapp3.1) (< netcoreapp2.0) (< netstandard2.1)) (&& (== netcoreapp3.1) (>= netcoreapp5.0)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (< portable-net45+wp8)) (&& (== netcoreapp3.1) (>= uap10.1)) (== netstandard2.0) System.Reflection.Extensions (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) @@ -213,7 +259,7 @@ NUGET Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) System.Reflection.TypeExtensions (4.7) - System.Resources.ResourceManager (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Resources.ResourceManager (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp5.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Globalization (>= 4.3) @@ -222,7 +268,7 @@ NUGET System.Runtime (4.3.1) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (4.7) - restriction: || (&& (== netcoreapp3.1) (>= monotouch)) (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (&& (== netcoreapp3.1) (< netcoreapp2.1)) (&& (== netcoreapp3.1) (< netstandard1.1)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= uap10.1)) (&& (== netcoreapp3.1) (>= xamarinios)) (&& (== netcoreapp3.1) (>= xamarinmac)) (&& (== netcoreapp3.1) (>= xamarintvos)) (&& (== netcoreapp3.1) (>= xamarinwatchos)) (== netstandard2.0) + System.Runtime.CompilerServices.Unsafe (4.7) System.Runtime.Extensions (4.3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1.1) Microsoft.NETCore.Targets (>= 1.1.3) @@ -258,31 +304,36 @@ NUGET System.Security.Permissions (4.7) System.Security.AccessControl (>= 4.7) System.Windows.Extensions (>= 4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.0)) - System.Security.Principal.Windows (4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + System.Security.Principal.Windows (4.7) System.Text.Encoding (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) + System.Text.Encoding.CodePages (4.7) + Microsoft.NETCore.Platforms (>= 3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp2.0)) + System.Runtime.CompilerServices.Unsafe (>= 4.7) - restriction: || (&& (== netcoreapp3.1) (>= net461)) (&& (== netcoreapp3.1) (< netcoreapp2.0)) (== netstandard2.0) System.Text.Encoding.Extensions (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) System.Text.Encoding (>= 4.3) - System.Text.RegularExpressions (4.3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Text.RegularExpressions (4.3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp5.0)) System.Runtime (>= 4.3.1) - System.Threading (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Threading (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp5.0)) System.Runtime (>= 4.3) System.Threading.Tasks (>= 4.3) - System.Threading.Tasks (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Threading.Tasks (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp5.0)) Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) System.Runtime (>= 4.3) - System.Threading.Tasks.Extensions (4.5.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) + System.Threading.Tasks.Extensions (4.5.3) + System.Runtime.CompilerServices.Unsafe (>= 4.5.2) - restriction: || (&& (== netcoreapp3.1) (>= net45)) (&& (== netcoreapp3.1) (< netcoreapp2.1)) (&& (== netcoreapp3.1) (< netstandard1.0)) (&& (== netcoreapp3.1) (< netstandard2.0)) (&& (== netcoreapp3.1) (>= wp8)) (== netstandard2.0) System.Threading.Thread (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.Runtime (>= 4.3) System.Threading.ThreadPool (4.3) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) System.Runtime (>= 4.3) System.Runtime.Handles (>= 4.3) + System.ValueTuple (4.5) System.Windows.Extensions (4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.0)) System.Drawing.Common (>= 4.7) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp3.0)) System.Xml.ReaderWriter (4.3.1) - restriction: || (== netcoreapp3.1) (&& (== netstandard2.0) (>= netcoreapp1.0)) @@ -333,3 +384,6 @@ NUGET System.Xml.ReaderWriter (>= 4.3) System.Xml.XmlDocument (>= 4.3) System.Xml.XPath (>= 4.3) +GITHUB + remote: fsprojects/fantomas + src/Fantomas/CodePrinter.fs (829faa6ba834f99afed9b4434b3a1680536474b2) \ No newline at end of file diff --git a/src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj b/src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj new file mode 100644 index 0000000000..14fd998fd3 --- /dev/null +++ b/src/Fantomas.Benchmarks/Fantomas.Benchmarks.fsproj @@ -0,0 +1,16 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + + + + \ No newline at end of file diff --git a/src/Fantomas.Benchmarks/Program.fs b/src/Fantomas.Benchmarks/Program.fs new file mode 100644 index 0000000000..85305a61b2 --- /dev/null +++ b/src/Fantomas.Benchmarks/Program.fs @@ -0,0 +1,8 @@ +open BenchmarkDotNet.Running +open Fantomas.Benchmarks.Runners + +[] +let main _ = + BenchmarkRunner.Run() + |> ignore + 0 diff --git a/src/Fantomas.Benchmarks/Runners.fs b/src/Fantomas.Benchmarks/Runners.fs new file mode 100644 index 0000000000..ccddab09c7 --- /dev/null +++ b/src/Fantomas.Benchmarks/Runners.fs @@ -0,0 +1,24 @@ +module Fantomas.Benchmarks.Runners + +open BenchmarkDotNet.Attributes +open System.IO +open FSharp.Compiler.SourceCodeServices +open Fantomas + +let sharedChecker = lazy FSharpChecker.Create() +let config = Fantomas.FormatConfig.FormatConfig.Default + +[] +[] +[] +type CodePrinterTest() = + [] + member _.Format() = + let path = __SOURCE_DIRECTORY__ + "/../../paket-files/fsprojects/fantomas/src/Fantomas/CodePrinter.fs" + let fileName = Path.GetFileName(path) + let parsingOptions = FakeHelpers.createParsingOptionsFromFile fileName + let content = File.ReadAllText(path) |> SourceOrigin.SourceString + CodeFormatter.FormatDocumentAsync(fileName, content, config, parsingOptions, sharedChecker.Value) + |> Async.RunSynchronously + |> ignore + () \ No newline at end of file diff --git a/src/Fantomas.Benchmarks/paket.references b/src/Fantomas.Benchmarks/paket.references new file mode 100644 index 0000000000..01a7c8e5bf --- /dev/null +++ b/src/Fantomas.Benchmarks/paket.references @@ -0,0 +1,3 @@ +FSharp.Core +FSharp.Compiler.Service +BenchmarkDotNet \ No newline at end of file