#running #measure #function #expose #callback

cost

测量运行函数的成本

2 个版本

0.1.1 2022年1月13日
0.1.0 2022年1月13日

#1357 in 开发工具

MIT 许可证

3KB
54

Cost

测量运行函数的成本。

此库公开了一个函数,该函数接受一个回调并返回运行该函数的成本。

let (cost, num) = cost(|| fibonacci(20));
println!("it cost {} instructions to compute {}", cost, num);

无运行时依赖

~185KB