Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET micro-benchmarking API [closed]

I'm looking for a library for doing micro-benchmarking of unit tests to monitor how code changes impact performance over time. That is, I would like the library to output results to e.g. XML to preserve history. It must be able to do this without any human assistant (i.e. run continously on our build server without too much hassle).

The library should be very simple and work on existing unit tests. Preferably I want to mark a test with a [Benchmark] attribute on the test I want to test or using a using-block, e.g.

using (var benchmarker = new Benchmarker())
{
  // Code to profile
} // Dispose() stores measurements.

Note that I'm not interrested in profiling tools as I programatically wan't to specify what parts of the code I want to profile. The library should be actively maintained.

I've had a look at Jon Skeet's solution, but found it to be a bit too intrusive and NTime which has been dead for a few years.

like image 911
larsmoa Avatar asked Jun 20 '11 10:06

larsmoa


1 Answers

You can use Performance Profiler on unit tests, and save the results. Make your changes, and reprofile. There are more complex ways of doing it, but adding a new workflow is not always the best option.

like image 108
JB Reefer Avatar answered Oct 14 '22 03:10

JB Reefer