Skip to content

Instantly share code, notes, and snippets.

@avestura
Created April 26, 2023 17:35
Show Gist options
  • Save avestura/9706a7f7040f3aa0640e29c7bb1fb7e1 to your computer and use it in GitHub Desktop.
Save avestura/9706a7f7040f3aa0640e29c7bb1fb7e1 to your computer and use it in GitHub Desktop.
CPU Affinity Test
open System
open System.Linq
open System.Diagnostics
// change cpu affinity while app is running
// run in debug mode: optimizations off
printfn "Press enter to continue"
Console.ReadKey () |> ignore
let f x = x
for i in 0..10_000_000 do
let sw = Stopwatch()
sw.Start()
for j in 0..1000_000_000 do
f j |> ignore
sw.Stop()
printfn "round %i done, took %d ms" i sw.ElapsedMilliseconds
printfn "Hello from F#"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment