Skip to content

Commit

Permalink
Update Equality.fs
Browse files Browse the repository at this point in the history
  • Loading branch information
psfinaki committed Feb 9, 2024
1 parent 640531d commit 7329ee1
Showing 1 changed file with 8 additions and 60 deletions.
68 changes: 8 additions & 60 deletions tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Equality.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,136 +13,84 @@ type EqualityBenchmarks() =
member _.ArrayCountBy() =
Array.init 1000 id
|> Array.countBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ArrayGroupBy() =
Array.init 1000 id
|> Array.groupBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ArrayContains() =
Array.init 1000 id
|> Array.map SomeStruct
|> Array.contains (SomeStruct 42)
|> ignore

[<Benchmark>]
member _.ArrayDistinct1() =
member _.ArrayDistinct() =
Array.init 1000 id
|> Array.map (fun n -> SomeStruct(n % 7))
|> Array.distinct
|> ignore

[<Benchmark>]
member _.ArrayDistinct2() =
Array.init 1000 id
|> Array.map (fun n -> n % 7)
|> Array.distinct
|> ignore

[<Benchmark>]
member _.ArrayDistinctBy() =
Array.init 1000 id
|> Array.distinctBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ArrayExcept() =
Array.init 1000 id
|> Array.map SomeStruct
|> Array.except ([| SomeStruct 42 |])
|> ignore

[<Benchmark>]
member _.ListCountBy() =
List.init 1000 id
|> List.countBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ListGroupBy() =
List.init 1000 id
|> List.groupBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ListContains() =
List.init 1000 id
|> List.map SomeStruct
|> List.contains (SomeStruct 42)
|> ignore

[<Benchmark>]
member _.ListDistinct1() =
member _.ListDistinct() =
List.init 1000 id
|> List.map (fun n -> SomeStruct(n % 7))
|> List.distinct
|> ignore

[<Benchmark>]
member _.ListDistinct2() =
List.init 1000 id
|> List.map (fun n -> n % 7)
|> List.distinct
|> ignore

[<Benchmark>]
member _.ListDistinctBy() =
List.init 1000 id
|> List.distinctBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.ListExcept() =
List.init 1000 id
|> List.map SomeStruct
|> List.except ([| SomeStruct 42 |])
|> ignore

[<Benchmark>]
member _.SeqCountBy() =
Seq.init 1000 id
|> Seq.countBy (fun n -> SomeStruct(n % 7))
|> ignore
|> Seq.last

[<Benchmark>]
member _.SeqGroupBy() =
Seq.init 1000 id
|> Seq.groupBy (fun n -> SomeStruct(n % 7))
|> ignore

[<Benchmark>]
member _.SeqContains() =
Seq.init 1000 id
|> Seq.map SomeStruct
|> Seq.contains (SomeStruct 42)
|> ignore
|> Seq.last

[<Benchmark>]
member _.SeqDistinct1() =
member _.SeqDistinct() =
Seq.init 1000 id
|> Seq.map (fun n -> SomeStruct(n % 7))
|> Seq.distinct
|> ignore

[<Benchmark>]
member _.SeqDistinct2() =
Seq.init 1000 id
|> Seq.map (fun n -> n % 7)
|> Seq.distinct
|> ignore
|> Seq.last

[<Benchmark>]
member _.SeqDistinctBy() =
Seq.init 1000 id
|> Seq.distinctBy (fun n -> SomeStruct(n % 7))
|> ignore
|> Seq.last

[<Benchmark>]
member _.SeqExcept() =
Seq.init 1000 id
|> Seq.map SomeStruct
|> Seq.except ([| SomeStruct 42 |])
|> ignore
|> Seq.last

0 comments on commit 7329ee1

Please sign in to comment.