{"action":"closed","issue":{"url":"https://api.github.com/repos/PerfDotNet/BenchmarkDotNet/issues/135","repository_url":"https://api.github.com/repos/PerfDotNet/BenchmarkDotNet","labels_url":"https://api.github.com/repos/PerfDotNet/BenchmarkDotNet/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/PerfDotNet/BenchmarkDotNet/issues/135/comments","events_url":"https://api.github.com/repos/PerfDotNet/BenchmarkDotNet/issues/135/events","html_url":"https://github.com/PerfDotNet/BenchmarkDotNet/issues/135","id":145377463,"number":135,"title":"BenchmarkDotNet already supports running F# benchmarks on .NET Core","user":{"login":"adamsitnik","id":6011991,"avatar_url":"https://avatars.githubusercontent.com/u/6011991?v=3","gravatar_id":"","url":"https://api.github.com/users/adamsitnik","html_url":"https://github.com/adamsitnik","followers_url":"https://api.github.com/users/adamsitnik/followers","following_url":"https://api.github.com/users/adamsitnik/following{/other_user}","gists_url":"https://api.github.com/users/adamsitnik/gists{/gist_id}","starred_url":"https://api.github.com/users/adamsitnik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamsitnik/subscriptions","organizations_url":"https://api.github.com/users/adamsitnik/orgs","repos_url":"https://api.github.com/users/adamsitnik/repos","events_url":"https://api.github.com/users/adamsitnik/events{/privacy}","received_events_url":"https://api.github.com/users/adamsitnik/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-02T14:22:43Z","updated_at":"2016-04-20T10:14:12Z","closed_at":"2016-04-20T10:14:12Z","body":"This week at #Build2016 F# support for .NET Core was announced. I have grabbed our code to check what is needed to be done to get it working. It turns out that we already support it!! Mainly due to the reuse of dotnet cli features.\r\n\r\nSo I just added sample F# benchmark to our repo, it can be found [here](https://github.com/PerfDotNet/BenchmarkDotNet/tree/develop/BenchmarkDotNet.Samples.FSharp.Core) I have reused existing F# sample.\r\n\r\nproject.json:\r\n\r\n```json\r\n{\r\n  \"version\": \"1.0.0-*\",\r\n\r\n  \"compilationOptions\": {\r\n    \"emitEntryPoint\": true,\r\n    \"optimize\": true\r\n  },\r\n\r\n  \"compilerName\": \"fsc\",\r\n  \"compileFiles\": [\r\n    \"Program.fs\"\r\n  ],\r\n\r\n  \"commands\": {\r\n    \"run\": \"BenchmarkDotNet.Samples.FSharp\"\r\n  },\r\n\r\n  \"dependencies\": {\r\n    \"BenchmarkDotNet\": {\r\n      \"target\": \"package\",\r\n      \"version\": \"0.9.4-beta\"\r\n    },\r\n    \"Microsoft.FSharp.Core.netcore\": \"1.0.0-alpha-151221\",\r\n    \"NETStandard.Library\": \"1.0.0-rc2-23811\"\r\n  },\r\n\r\n  \"frameworks\": {\r\n    \"dnxcore50\": { }\r\n  }\r\n}\r\n```\r\n\r\nProgram.fs\r\n```fsharp\r\nmodule Program\r\n\r\nopen System\r\nopen System.IO\r\nopen System.Collections.Concurrent\r\nopen BenchmarkDotNet.Attributes\r\nopen BenchmarkDotNet.Running\r\n\r\nlet getStrings len = Array.init len (fun _ -> Path.GetRandomFileName())\r\n\r\nlet lookup arr (dict:ConcurrentDictionary<string,bool>) =\r\n    arr |> Array.iteri(fun idx elm -> \r\n        let mutable b = dict.[elm]\r\n        b <- dict.[arr.[0]])\r\n\r\n\r\ntype StringKeyComparison () =\r\n    let mutable arr : string [] = [||]\r\n    let dict1 = ConcurrentDictionary<_,_>()\r\n    let dict2 = ConcurrentDictionary<_,_>(StringComparer.Ordinal)\r\n\r\n    [<Params (100, 500, 1000, 2000)>] \r\n    member val public DictSize = 0 with get, set\r\n\r\n    [<Setup>]\r\n    member self.SetupData() =\r\n        dict1.Clear(); dict2.Clear()\r\n        arr <- getStrings self.DictSize\r\n        arr |> Array.iter (fun x -> dict1.[x] <- true ; dict2.[x] <- true)\r\n\r\n    [<Benchmark>]\r\n    member self.StandardLookup () = lookup arr dict1\r\n\r\n    [<Benchmark>]\r\n    member self.OrdinalLookup () = lookup arr dict2\r\n\r\n\r\nlet defaultSwitch () = BenchmarkSwitcher [| typeof<StringKeyComparison>  |]\r\n\r\n[<EntryPoint>]\r\nlet Main args =\r\n    defaultSwitch().Run args \r\n    0\r\n\r\n```\r\n\r\nNuGet.Config\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<configuration>\r\n  <packageSources>\r\n    <!--To inherit the global NuGet package sources remove the <clear/> line below -->\r\n    <clear />\r\n    <add key=\"dotnet-core\" value=\"https://dotnet.myget.org/F/dotnet-core/api/v3/index.json\" />\r\n    <add key=\"api.nuget.org\" value=\"https://api.nuget.org/v3/index.json\" />\r\n    <add key=\"fsharp-daily\" value=\"https://www.myget.org/F/fsharp-daily/api/v3/index.json\" />\r\n  </packageSources>\r\n</configuration>\r\n```\r\n\r\ncommands needed to execute:\r\n```\r\ndotnet restore\r\ndotnet run\r\n\r\n```"}}