Skip to content

Commit

Permalink
floats
Browse files Browse the repository at this point in the history
  • Loading branch information
psfinaki committed Feb 23, 2024
1 parent 05af9c8 commit 7b821e1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ type BasicTypes() =
let uint64s = Array.init 1000 uint64
let intptrs = Array.init 1000 nativeint
let uintptrs = Array.init 1000 unativeint
let floats = Array.init 1000 float
let float32s = Array.init 1000 float32
let chars = Array.init 1000 char
let strings = Array.init 1000 string
let decimals = Array.init 1000 decimal
Expand Down Expand Up @@ -55,12 +53,6 @@ type BasicTypes() =
[<Benchmark>]
member _.UIntPtr() = uintptrs |> Array.distinct

[<Benchmark>]
member _.Float() = floats |> Array.distinct

[<Benchmark>]
member _.Float32() = float32s |> Array.distinct

[<Benchmark>]
member _.Char() = chars |> Array.distinct

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Equality

open BenchmarkDotNet.Attributes

[<MemoryDiagnoser>]
type Floats() =

let numbers = Array.init 1000 (fun id -> id % 7)

[<Benchmark>]
member _.FloatER() = numbers |> Array.groupBy float

[<Benchmark>]
member _.Float32ER() = numbers |> Array.groupBy float32

[<Benchmark>]
member _.FloatPER() = numbers |> Array.Parallel.groupBy float

[<Benchmark>]
member _.Float32PER() = numbers |> Array.Parallel.groupBy float32
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Compile Include="Equality\BasicTypes.fs" />
<Compile Include="Equality\FSharpCoreFunctions.fs" />
<Compile Include="Equality\Arrays.fs" />
<Compile Include="Equality\Floats.fs" />
<Compile Include="Equality\ValueTypes.fs" />
<Compile Include="Equality\Misc.fs" />
<Compile Include="Equality\ValueTuples.fs" />
Expand Down

0 comments on commit 7b821e1

Please sign in to comment.