How to profile silverlight mvvm application with lots of customizable controls

There is a fairly large Silverlight LOB application, and we have written many custom controls that are quite difficult to draw.

All data is loaded by the RIA service, processed and attached (using the INofityPropertyChanged interface) to the view.

The problem is that the first drawing takes a lot of time. Subsequent calls to the service (server) and redrawing are pretty fast.

I used the Equatec profiler to track the problem. I saw that processing takes a couple of milliseconds, so my idea is that drawing with the SL engine is slow.

I am wondering if it is possible to somehow process inside SL to check which drawing operations take too much time. Are there any recommendations for implementing faster drawing of complex user controls?

+4
source share
2 answers

The short answer is No, there is no easy way to find out why your application is slow.

Long answer:
I have never used the Equatec profiler for Silverlight, but it looks like dotTrace. In any case, both of them display the same information as xPerf .
Basically, the information you need to have in front of you says which methods and classes take the most time to execute.

If this information points to the Silverlight platform graphics engine (agcore.dll and npctrl.dll), you will need to start the slow process of determining what you did wrong.
At this point, I strongly recommend that you follow every conversation that Sima Ramchandani talked about about Silverlight's performance. In particular, PDC08 , Mix09 and Mix10 .

Step # 1 of priority optimization . Measure. Measure. To measure.
You have a clear foundation for what you are trying to improve, and set the numerical expectation when performance is enough.
This way you can verify that your changes have a positive effect on performance.

Step # 2 of primary optimization . Start deleting files.
In your case, I would start commenting out the controls outside the form. When the effect of the array improves, you find your culprit.

Step No. 3 of priority optimization . Try to fix the weak link.

How I would decide to solve this problem.

Respectfully,
- Justin Angel

+7
source

Try profiling the Visual Studio profiler to get a good estimate of your managed code and native code running in Silverlight. The profiler will help you indicate where you spend most of your time (what a hot path is), and whether you spend it in frame code (SL) or on your own code.

Profiling Basics:

  • Open the Visual Studio command prompt (as admin), 'cd' in the directory where your DLL and PDB files are located (usually this is the Debug folder)
  • VSPerfClrEnv / sampleon
  • VSPerfCmd -start: sample -output: somefile.vsp VSPerfCmd -globalon VSPerfCmd -launch: "c: \ Program Files (x86) \ Internet Explorer \ iexplore.exe" -args: ""
  • VSPerfCmd -shutdown
  • VSPerfClrEnv / off

Detailed instructions for using the profiler can be found on my blog: http://www.nachmore.com/2010/profiling-silverlight-4-with-visual-studio-2010/

If you find yourself spending time in Silverlight, track the code path to find out where your code launches costly calls so you can then investigate specific solutions based on the reason for the slowdown.

Hope this helps,

  • Oren
+2
source

Source: https://habr.com/ru/post/1310624/


All Articles