BenchShark is our new product allowing the developers to measure the speed of a set of functions in order to make sure they aren't and won't become a bottleneck for their .NET applications. The project initially started when we wanted to optimize the library MemorySharp. There is a lot of tools on the market, from open source to very expensive solutions. We wanted to focus on a lightweight product that allows to make automatic checking in order to avoid regressions. Also, benchmarking in .NET must follow several best practices to provide valuable results. They are notably defined by Eric Lippert, a person who contributed to the C# compiler at Microsoft.
Here is a very quick overview of BenchShark. Basically, your application contains a function that performs some operations and takes some time to be executed.
public static double Power(int x, int y) { return Math.Pow(x, y); }
The function can be benchmarked with a number of iterations to measure its performance.var result = new BenchShark().EvaluateTask(() => Power(5, 5), 100);
Finally, to ensure that the function won't become a bottleneck, the result can be unit tested.Assert.IsTrue(result.AverageExecutionTime < TimeSpan.FromSeconds(1));
I (ZenLulz) recently decided to start a blog to talk about C# optimization, tips & tricks. My first post will be dedicated to this library and write a summary of the best practices of the benchmarking using a managed language in general. A section in the forum was created for questions, feedbacks and ideas concerning BenchShark. Do not hesitate to post your message over there.
In addition, a new section was created in the forum. This new section is about extensions made for MemorySharp. If you built a nice piece of code that extends the library and you think it can be useful for other developers, you can advertise your development by creating your own thread there.
To conclude, as some of you already noticed, we changed the font of the website. From Helvetica Neue, we chose to use Open Sans that brings a sweet rendering and more pleasant to read.
We also wanted to thanks the members on the board to have submitted a lot of bugs in our libraries !
Click here to view the article