Skip to content

Instantly share code, notes, and snippets.

@jackmott
Created August 24, 2016 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackmott/1fb6de0ea457b4ff3fc08ff0ac417926 to your computer and use it in GitHub Desktop.
Save jackmott/1fb6de0ea457b4ff3fc08ff0ac417926 to your computer and use it in GitHub Desktop.
Pricer Perf Test
module Pricer.PerfTests
open System
open Pricer
open Pricer.Core
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
open BenchmarkDotNet.Configs
open BenchmarkDotNet.Jobs
#if MONO
#else
open BenchmarkDotNet.Diagnostics.Windows
#endif
type BenchConfig () =
inherit ManualConfig()
do
base.Add Job.RyuJitX64
#if MONO
#else
base.Add(new MemoryDiagnoser())
#endif
[<Config (typeof<BenchConfig>)>]
type BinomialBenchmark () =
let stock = {
Volatility = 0.05
Rate = 0.03
CurrentPrice = 230.0
}
let europeanCall = {
Strike = 231.0
Expiry = new DateTime(2015,12,12)
Direction = 1.0
Kind = Call
Style = European
PurchaseDate = new DateTime(2015,9,5)
}
[<Params (1000)>]
member val public Steps = 0 with get, set
[<Setup>]
member self.SetupData () =
()
[<Benchmark>]
member self.Func () =
Binomial.binomial stock europeanCall self.Steps Functional
[<Benchmark(Baseline=true)>]
member self.FuncFast () =
Binomial.binomial stock europeanCall self.Steps FunctionalFast
[<EntryPoint>]
let main argv =
BenchmarkRunner.Run<BinomialBenchmark>() |> ignore
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment