测量F#中的执行时间 [英] Measure time of execution in F#

查看:110
本文介绍了测量F#中的执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请发布用于在F#中显示时间的代码.我注意到您可以使用#time指令从F#交互中进行测量,但是我不知道如何从FSI执行程序

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

谢谢

推荐答案

我只使用.NET秒表类.

I would just use the .NET Stopwatch class.

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

这篇关于测量F#中的执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆