Skip to content

Instantly share code, notes, and snippets.

@dsyme
Last active March 1, 2016 16:06
Show Gist options
  • Save dsyme/0f3c6e5ac3d9f5e2d723 to your computer and use it in GitHub Desktop.
Save dsyme/0f3c6e5ac3d9f5e2d723 to your computer and use it in GitHub Desktop.
struct tuples
open System
let run() =
for i in 0 .. 10 do
let size = 10000000
GC.Collect()
let watch = Diagnostics.Stopwatch.StartNew()
let mutable arrTuple = Array.init size (fun i -> (i,i))
arrTuple <- [|(0,0)|]
watch.Stop()
GC.Collect()
printfn "Took %A ms" watch.Elapsed.TotalMilliseconds
watch.Restart()
let mutable arrStruct = Array.init size (fun i -> struct (i,i))
arrStruct <- [| struct (0,0)|]
watch.Stop()
GC.Collect()
printfn "Took %A ms" watch.Elapsed.TotalMilliseconds
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment