Created
July 25, 2016 10:04
-
-
Save liboz/d1d513c378aefbc78889f2db27f2800f to your computer and use it in GitHub Desktop.
groupByBenchmarkDotNet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open BenchmarkDotNet.Running | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Configs | |
open BenchmarkDotNet.Diagnostics.Windows | |
type groupBy () = | |
[<Params(10, 100, 10000, 1000000, 10000000)>] | |
member val public count = 0 with get, set | |
[<Benchmark>] | |
member this.groupByModulus () = | |
List.groupBy (fun i -> i % 2) [1..this.count] | |
[<Benchmark>] | |
member this.groupByOriginalModulus () = | |
List.groupBy2 (fun i -> i % 2) [1..this.count] | |
[<Benchmark>] | |
member this.groupBy () = | |
List.groupBy id [1..this.count] | |
[<Benchmark>] | |
member this.groupByOriginal () = | |
List.groupBy2 id [1..this.count] | |
[<Benchmark>] | |
member this.groupByMixed () = | |
List.groupBy (fun i -> i % 2) (List.concat [[1..this.count]; [1..(max 10000 this.count/2)]; [1..(max 10000 this.count/2)]]) | |
[<Benchmark>] | |
member this.groupByOriginalMixed () = | |
List.groupBy2 (fun i -> i % 2) (List.concat [[1..this.count]; [1..(max 10000 this.count/2)]; [1..(max 10000 this.count/2)]]) | |
let [<EntryPoint>] main args = | |
let config = ManualConfig.Create(DefaultConfig.Instance) | |
config.Add(new MemoryDiagnoser()) | |
config.Add(new InliningDiagnoser()) | |
BenchmarkRunner.Run<groupBy>(config) |> ignore | |
0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment