P
P
pixik2015-03-30 09:47:45
C++ / C#
pixik, 2015-03-30 09:47:45

How to find bottlenecks in an MFC project where performance can sag a lot?

Good time!
The problem is the following, there is a project on MFC, at startup, just drawing the window takes 25-30% of the processor time. I can't find exactly that little infinite loop where this can happen. When you try to run the profiler, after writing a file with profiling data, the studio crashes. As a result, I can't see which function sags...
I did TRACE(..) in the OnPaint() method, connected with debugging and saw a ton of messages from OnPaint. Apparently his calls all the time and eat. But how to understand what is causing ... after all, these are mostly callbacks.
Who struggled with the performance, please share :) maybe there are some primary signs like a lot of invalidate () calls in the code, while (a == true) or something else.
UPD#1
When trying to profile from Visual studio 2013, we get the following:
2218d8fd6e7448289d0e26f0a4a8da42.JPG9ffd8774f17144b9a2c90e3b1d392518.JPG1db60585480b4e98af17eb3fe6501175.JPG
UPD #2
The SPY++ program showed that a ton of WM_KICKIDLE messages are indeed being sent, although it is not clear where they come from.
Strange, I didn’t change anything in the code, even after all the tests I rolled back the commit, but the performance problem disappeared. A little annoying such a number of WM_KICKIDLE messages.
8ebfbe3b2620497b9567ec453890fc17.JPG
Thanks everyone!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AxisPod, 2015-03-30
@pixik

Well, look for the Invalidate project and see where they are called from. Again, it is not a fact that it is Invalidate that leads to this, look at what events fly where. Spy++ is here to help.

A
Armenian Radio, 2015-03-30
@gbg

I would try to fix the studio, because inventing a crutch, while there is a standard tool - a profiler - is somehow strange.
Well, or open up the project and MFC sources, look for what is being done there, in OnPaint.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question