I have a C# application that compiles other C# functions on-the-fly depending on user selections. There are several C# functions that can be selected. There is one that takes considerably longer than the rest. This function seems to have an unusual performance characteristic. If it is the first one selected it takes 7 times longer to run than if it is not the first one selected. In other words if I start the application and select this one function and compile and run it it takes 7 minutes to run (only timing the function exectution, not compile time, etc...). If I select it again (no recompilation done here) and run it it only take 1 minute to run. Also, if I restart the application and select one of the other functions to run first and then select the this one it again only takes 1 minute to run. I can run it several times after the first time and each time it only takes 1 minute. However, if it is the first function selected (after the applications is restarted) then it takes 7 minutes.
Any ideas on the cause of this slow performance the first time? In usual use there will only be one function selected to run and it will always be after an application restart which implies it will always take 7 minutes to run that function.