Why would switching user profiles improve WinForms performance?
Our users have been grumbling about the performance of our WinForms app for the past couple months. There are plenty of articles out there on the web concerning how to improve WinForms performance, so I'm not looking for any of th开发者_Python百科ose obvious suggestions.
What I've got is a Voodoo solution that seems to work, and I don't have any reason why. If we simply switch users, i.e. logout, then log in to the machine with a user who has never logged in before, then launch the application, it has the nice snappy performance that everyone loves.
Trouble is, I have no idea why that works. We don't write anything to the AppData directory, all our log files are in the run directory(which I realize is bad practice but we're running on XP and the app was built years ago). We're not writing to the registry, so that can't be it either.
The best I can find on the web are very vague claims about "clearing out temp files", but I can't really recommend a process change because of that.
Maybe the standard user has some additional processes running on the background of the machine and those processes stealing your performances. Ever tried running the application in windows protected mode?
You can diagnose the problem more by using some professional applications such as Red Gate Performance Profiler, it is not free but they have 14 days trial period. However here is some common\possible problems:
- Check out the virtual memory of your application, maybe it is increasing repeatedly without you notice you can run your task manager and go to Performance tab and watch the PF Usage.., in your code, check if you are creating some
Disposable
object or resource without disposing it/closing them. - You should use more professional library for logging such as Log4Net, However if you want to do the logging your self, I suggest you to switch of to use
EventLog
and also try to do the logging in asynchronous way.
精彩评论