Application.Run is the main processor consumption function in my application; what can i optimize?

My WPF application has a feature due to which it displays a large number of images in the background when the user interface is updated with each new image.

Profiling this process showed that Application.Run is a function that does most of the work, at 43%, with the "second most expensive" place shared by three graphical APIs, each at 6%.

What can I do, it will cause so much time spent on Application.Run ? It seems that the kernel of this method launches the main dispatcher for my application, but it does not help me understand what such a dispatcher does so much. Can I get a finer grain profile?

Note. I mean System.Windows.Application.Run .

+6
source share
1 answer

It turns out that Visual Profiler (part of the WPF Performance Suite ) can provide a more detailed breakdown of CPU usage:

CPU usage breakdown

This shows that half of this inexplicable CPU usage is reduced to the rendering stream (so maybe I should update the UI less often), and most of the rest is in my Invoke callback (which is inevitable in my case).

+4
source

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


All Articles