Is it possible to run an ASP.NET core 2.1 app in such a way that it will perform the same each time? I want to analyse the performance of certain parts (already found some issues that need fixing here), but using the Stopwatch class is a bit inconsistent. It would be very helpful if I could have it run the exact same way every time.
My plan (which I’ve done already with some success) is to play about with changing or removing bits of code to find out where the real bottlenecks are. Consistent timings would be really handy here.
I’ve made a console app that calls the method I’ve identified as slow directly, but it runs far faster here than in the web app. I’m guessing that this is simply due to less overhead, will this still be a good indicator of where the slow parts are or do I need to run this analysis in the web app itself?
The database used is an in memory one, so I don’t need to worry about external db calls being inconsistent.
Sorry if any of this isn’t clear.