Last active
March 1, 2016 16:06
-
-
Save dsyme/0f3c6e5ac3d9f5e2d723 to your computer and use it in GitHub Desktop.
struct tuples
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 | |
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