Improving performance of C# program when run from network drive
-
Hello, I am having some problems when running a C# application that I've written. It runs fairly smooth on a local machine (test machine). However, when I am running this from a network drive, the responsiveness is slow. When I click on a button that opens up a form, there is a considerable lag (5-10 seconds sometimes). Is there anything that I can do to speed this up on a network?
-
Hello, I am having some problems when running a C# application that I've written. It runs fairly smooth on a local machine (test machine). However, when I am running this from a network drive, the responsiveness is slow. When I click on a button that opens up a form, there is a considerable lag (5-10 seconds sometimes). Is there anything that I can do to speed this up on a network?
There is no generic method that will speed anything up. Code doesn't run faster or slower depending on where you ran it from. Code runs at the processor speed, not the network. Now, any processing you have on data is remote locations or stored in files is where you'll run into problems with performance. Since we have no idea what you're code is doing when you "click a button that opens up a form", there is nothing anyone can tell you that is going to help. We need more detail about EXACTLY what your code is doing when you run into this problem.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Hello, I am having some problems when running a C# application that I've written. It runs fairly smooth on a local machine (test machine). However, when I am running this from a network drive, the responsiveness is slow. When I click on a button that opens up a form, there is a considerable lag (5-10 seconds sometimes). Is there anything that I can do to speed this up on a network?
As Dave mentioned, you didn't give a lot of details so I'll take a stab in the dark and say that your "work" is probably being done on the UI thread rather than on a background worker or other type of thread. (If you have no idea what that means then you are definitely working on the UI thread.) That will kill UI performance if you start mixing long-running operations such as disk-based access or network-based access. Your UI will hang while it processes the work because there is only one guy in the room doing anything. If this is the case, you will want to change your worker method(s) to use an async pattern so you can decouple the long-running work operations from the UI. That will keep things responsive... at least on the UI.