IDA speed problem analysis
Andrew de Quincey
adq_dvb at lidskialf.net
Tue Dec 2 20:40:34 CST 2003
Hi, I've been doing some more work on this, and I think I've found the culprit
(my apologies to everyone for the crap I've been talking recently).
Whenever IDA opens the Save box.. and in fact when it does a lot of
operations, it seems to completely regenerate its menus. It uses an MDI
interface, and so uses the WM_MDISETMENU message to set menus.
The problem function is controls/menu.c/SetMenu(). Specifically, the call to
SetWindowPos() passing the SWP_FRAMECHANGED flag. If I comment this call out,
IDA becomes very fast... as fast as is it in windows. If I add in Y copies of
that call, IDA becomes about Y times slower.
Looking at the docs on MSDN for WM_MDISETMENU, it says "After sending this
message, an application must call the DrawMenuBar function to update the menu
bar". Which implies that the application is in charge of telling the menu bar
to redraw, meaning the call to SetWindowPos() is superfluous.
However, SetMenu() is used non by MDI menus as well, which DO expect the menu
to be updated automatically (MSDN: "The window is redrawn to reflect the menu
change"), which means it can't just be removed.
Does anyone have any suggestions for the cleanest way to resolve this? Perhaps
MDI should have an internal copy of SetMenu() tailored to its needs?
BTW, under windows, the MDI code does not call the USER32.SetMenu() function.
More information about the wine-devel