我如何确定哪些证明最耗时,以便能够与Assert
s 一起帮助验证者?
有没有比猜测和检查更好的方法?
有点。您可以使用该选项找到最慢的方法-stats slowmethods
(您也可以使用该选项-statsOnly
来简化日志输出)。
不幸的是,输出如下所示:
Methods taking the longest:
1: Method #196, 00:00:08.1438107
2: Method #143, 00:00:07.1916795
3: Method #68, 00:00:02.2282228
4: Method #71, 00:00:01.4211421
5: Method #438, 00:00:01.3781378
6: Method #452, 00:00:00.8640864
7: Method #78, 00:00:00.8330833
8: Method #439, 00:00:00.7390739
9: Method #72, 00:00:00.5760576
10: Method #75, 00:00:00.4090409
我不确定是否有办法从方法号中找到方法名称。
使用分析器来做到这一点,例如 Visual Studio 内置的。您可以从分析菜单中访问它。它将显示代码中所有方法的出现次数和次数。
当然也有第三方解决方案,例如Ants Profiler