Unexpected poor performance

G

Guest

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.
 
A

Alexander Muylaert

Only one to find it out.
Post your code. This doesn't say much.

Kind regards

Alexander
 
G

Guest

I wish I could but it is currently company proprietary and the performance is not yet important enough to warrant providing it. I can tell you this much - all the functions do basically the same thing. They open an input file (or a few files), read in the data one record at a time, process it and write out result records to an output file (or few files).

However, I have continued to investigate this and have found the following. If the long running function is called first it allocates memory continually. It ends up allocating around 250MB of memory. The other functions don't do this and this function does not do it if it is not the first function called.
 
J

Jon Skeet [C# MVP]

melvers said:
I wish I could but it is currently company proprietary and the
performance is not yet important enough to warrant providing it. I
can tell you this much - all the functions do basically the same
thing. They open an input file (or a few files), read in the data one
record at a time, process it and write out result records to an
output file (or few files).

However, I have continued to investigate this and have found the
following. If the long running function is called first it allocates
memory continually. It ends up allocating around 250MB of memory. The
other functions don't do this and this function does not do it if it
is not the first function called.

You don't need to post the actual code, necessarily. Post a short but
complete program which demonstrates the problem.

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top