I have a method in c# code behind..which needs to be executed 10000+ lines from Assemblies as well as in Child group Methods. My Question is How to optimize it? It is taking more than 40 Seconds Load to 500 Rows in my page my own gridview which is designed by mys开发者_JAVA技巧elf.
Profile your code. That will help you identify where its slow. From reading your post , optimizing might take you a long time since you have alot of code and data.
Virtualize as much as you can. Instead of loading 500 rows, can you try loading 50 rows first, show your UI then load the remainder 450 rows asynchronously ? This doesnt speed up your application, but at least it seems working much quicker than waiting 40 seconds.
This method is very simple, but it can pinpoint the activities that would profit the most by optimizing.
If there is a way to speed up your program, it is taking some fraction of time, like 60%. If you randomly interrupt it, under a debugger, you have a 60% chance of catching it in the act. If you examine the stack, and maybe some of the state variables, it will tell you with great precision just what the problem is. If you do it 10 times, you will see the problem on about 6 samples.
精彩评论