Skip to content

Instantly share code, notes, and snippets.

/bench.fs Secret

Created Mar 29, 2013
Embed
What would you like to do?
let len = Math.Pow(10., 6.) |> int
let solid_vector = SolidFS.Operators.Vector.ofSeq ( [0 .. len])
let fsharpx_vector = FSharpx.Collections.Vector.ofSeq<int>([0 .. len])
let xl = XList.empty<int>
let mutable iter = Math.Pow(10., 6.) |> int
let mutable time1 = 0L
let mutable time2 = 0L
let n = 30
let rnd = Random()
for __ = 0 to n do
// GC.Collect()
//GC.WaitForPendingFinalizers()
sw.Restart()
for i = 0 to iter do
let x = fsharpx_vector |> FSharpx.Collections.Vector.nth (rnd.Next(0, len))
()
sw.Stop()
time1 <- time1 + sw.ElapsedTicks
printfn "%A" (time1 )
for __ = 0 to n do
// GC.Collect()
// GC.WaitForPendingFinalizers()
sw.Restart()
for i = 0 to iter do
let x = solid_vector.[rnd.Next(0, len)]
()
//test_deq.Tail
sw.Stop()
time2 <- time2 + sw.ElapsedTicks
printfn "%A" time2
printfn "%A" ((float time1) / (float time2) )
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment