Measure time of execution in F#

后端 未结 4 791
走了就别回头了
走了就别回头了 2021-01-01 10:30

Please post code for displaying time in F#. I noticed that you can measure it from F# interactive with #time directive, but I don\'t know how to execute program from FSI

4条回答
  •  Happy的楠姐
    2021-01-01 11:07

    I would just use the .NET Stopwatch class.

    let stopWatch = System.Diagnostics.Stopwatch.StartNew()
    ...
    stopWatch.Stop()
    printfn "%f" stopWatch.Elapsed.TotalMilliseconds
    

提交回复
热议问题