In the first part of this post, I laid out the problem at hand and the code for some of the more high-level business logic. I left off by mentioning that the calls to the “repository” classes were hiding complexity which resulted in disastrously poor performance. In this post, I’ll dig into those methods and how I ultimately refactored them to increase the performance by over an order of magnitude.
This is a story about some code I recently refactored at work, which resulted in a process that previously took double-digit numbers of hours down to about 20 minutes. I think it’s an interesting case because it was such a dramatic performance increase, and the root cause for the performance problem was something I think software developers run into a lot.
While investigating migrating the API code in our application at work from the nearly-abandoned Jayrock RPC framework to the more widespread and well-supported ASP.NET WebAPI, I noticed that there was one nice-to-have that Jayrock enjoyed over WebAPI – it has a built-in automated tester which enables you to compose and submit AJAX requests to your API endpoints.