C# Code Contracts build time -- how do I improve it?

494 Views Asked by At

How do I figure out which proofs are the most time-consuming, to be able to help the verifier along with Asserts?

Is there any way that is better than guess-and-check?

2

There are 2 best solutions below

0
On

Sort of. You can find the slowest methods by using the option -stats slowmethods (you can also use -statsOnly to simplify the log output).

Unfortunately, the output looks like this:

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

I'm not sure if there's a way to find the method name from the method number.

0
On

Use profiler to do that, for example Visual Studio built-in one. You can reach it from Analyze menu. It will show you times and number of occurance for all methods in your code.

Of course there are also third party solutions, for example Ants Profiler