Rust 中的基准测试程序 [英] Benchmarking programs in Rust

查看:21
本文介绍了Rust 中的基准测试程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Rust 中对程序进行基准测试?例如,如何以秒为单位获得程序的执行时间?

How is it possible to benchmark programs in Rust? For example, how would I get execution time of program in seconds?

推荐答案

这个答案已经过时了!在基准测试方面,time 箱没有提供任何优于 std::time 的优势.请参阅下面的答案以获取最新信息.

This answer is outdated! The time crate does not offer any advantages over std::time in regards to benchmarking. Please see the answers below for up to date information.

<小时>

您可以尝试使用 time crate 为程序中的各个组件计时.


You might try timing individual components within the program using the time crate.

这篇关于Rust 中的基准测试程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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