Lots of people are very excited with Catel, but are somehow afraid that it will not perform because so much is possible and done automatically for you. Recently, we got a free license of the ANTS Performance Profiler for the efforts we put into Catel. We really appreciate it, and want to share our experience with profiling the performance.
Profiling the examples
The first thing we did was to profile the example applications. However, we couldn’t find any performance issues in the examples (even the larger ones). But, we have a work item to tackle the top 10 % most expensive calls, how to do that when all performance very well?
Well, we have a very large coverage of unit tests, so maybe we can profile these?
Profiling the unit tests
Now it really gets cool. I got the idea to profile our unit tests since it covers most of the (non-UI) API calls, so it would be a very good way to find the top 10 % worst performing methods. Then I stumbled upon this article. It tells in detail how to profile the performance using MSTest. How cool is that!
We use the following configuration to profile our unit tests:
After setting up the configuration, we only had to wait until all 1300 unit tests completed. I must admit it takes a while to run and analyze the results (appr. 5 minutes), but that’s a good time to get a cup of coffee. When we returned, we could select the part with the most red stuff and select it in the graph:
As we know, the binary redirect-serializer of Catel is the most expensive one (it allows you to change type names and assemblies when using binary serialization). It only costs much performance when the type system has actually changed, which happens in a “Convert to new format” wizard or something like that.
Anyway, it is very cool that we can now decide whether we want to put effort into this method and focus on what is really important for the users of Catel. For example, a validation sequence that takes 50 ms (that runs 5 times a second) has a higher priority than a once in a namespace changing redirect-serializer.
There are actually two conclusions:
- ANTS Performance Profiler rocks! How cool is it that when you cover everything using unit tests, you don’t need to test anything with a UI, but can simply run the unit tests. Maybe we can even integrate it into our continuous integration build and e-mail the top 10 % worst performing methods.
- While writing Catel, the team did an excellent job in keeping the performance in mind. We couldn’t find any real performance bottlenecks, so actually we are very, very happy with the results