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

查看:26
本文介绍了在 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天全站免登陆