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
[<Struct;IsByRefLike>] | |
type StackStack<'T>(values: Span<'T>) = | |
[<DefaultValue>] val mutable private Count : int | |
member s.Push v = | |
if s.Count < values.Length then | |
values[s.Count] <- v | |
s.Count <- s.Count + 1 | |
else | |
failwith "Exceeded capacity of StackStack" |
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
module Units = | |
[<Measure>] type private Chicken | |
module Chicken = | |
let create x = | |
if x < 0 then | |
invalidArg (nameof x) "Cannot have a Chicken <0" |
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 System | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Running | |
open BenchmarkDotNet.Diagnosers | |
[<HardwareCounters(HardwareCounter.BranchMispredictions, HardwareCounter.CacheMisses)>] | |
[<DisassemblyDiagnoser(printSource = true, exportHtml = true)>] | |
type Benchmarks () = | |
let rng = Random 123 |
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
// Validating benchmarks: | |
// ***** BenchmarkRunner: Start ***** | |
// ***** Found 2 benchmark(s) in total ***** | |
// ***** Building 1 exe(s) in Parallel: Start ***** | |
// start dotnet restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Users\matth\source\repos\TypedArrayIndexing\bin\Release\net6.0\af583c40-01ab-4113-bd10-b7f8ac106bac | |
// command took 1s and exited with 0 | |
// start dotnet build -c Release --no-restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Users\matth\source\repos\TypedArrayIndexing\bin\Release\net6.0\af583c40-01ab-4113-bd10-b7f8ac106bac | |
// command took 0.9s and exited with 1 | |
// start dotnet build -c Release --no-restore --no-dependencies /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Users\matth\source\repos\TypedArrayIndexing\bin\Release\net6.0\af583c40-01ab-4113-bd10-b7f8ac106bac | |
// command took 1.62s and exite |
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
[<Measure>] type Chicken | |
[<Measure>] type Cow | |
type Arr<[<Measure>] 'Measure>(v: array<_>) = | |
let values = v | |
member _.Item | |
with inline get (i: int<'Measure>) = | |
v.[int i] |
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
[<Measure>] type Chicken | |
[<Measure>] type Cow | |
type Arr<[<Measure>] 'Measure>(v: array<'T>) = | |
member _.Item | |
with get (i: int<'Measure>) = | |
v.[int i] | |
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
#r "nuget: Flips,2.4.7" | |
open Flips | |
open Flips.Types | |
let x = | |
DecisionBuilder "x" { | |
for index in 1..5 -> | |
Continuous (0.0, infinity) | |
} |> Map |
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
// Validating benchmarks: | |
// ***** BenchmarkRunner: Start ***** | |
// ***** Found 3 benchmark(s) in total ***** | |
// ***** Building 1 exe(s) in Parallel: Start ***** | |
// start dotnet restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Users\matth\source\repos\SliceMapPerformanceExploration\bin\Release\net5.0\4e898864-ad69-478b-a9ec-168807204bd8 | |
// command took 1.14s and exited with 0 | |
// start dotnet build -c Release --no-restore /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=true in C:\Users\matth\source\repos\SliceMapPerformanceExploration\bin\Release\net5.0\4e898864-ad69-478b-a9ec-168807204bd8 | |
// command took 1.86s and exited with 0 | |
// ***** Done, took 00:00:03 (3.09 sec) ***** | |
// Found 3 benchmarks: |
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
module rec TestTypes = | |
type Chicken = { | |
Size : int | |
} with | |
static member ( * ) (c: Chicken, i: int) = | |
{ Size = c.Size * i } | |
static member ( + ) (c1: Chicken, c2: Chicken) = | |
Flock [c1; c2] | |
static member ( + ) (c: Chicken, Flock f) = |
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 System | |
open System.Collections.Generic | |
module rec SliceMap = | |
[<Struct>] | |
type IndexRange = { | |
Start : int | |
Length : int | |
} |