GUI menu getting slower with multiple GUI opened
显示 更早的评论
Hi,
i'm experiencing a strange performance slowing down of a GUI, when using the menu callback.
My GUI (main), via nested menus is opening other instances of another GUI (seconday), and after two instances on the seconday GUI are opened, the menu drop down became slower and slower
looking at the profiler this is the operation causing this very long time execution (self time)
@(hObject,eventdata)Main('menu_Callback',hObject,eventdata,guidata(hObject))
and this is appening for each menu and sub menu
After opening two secondary GUI, this take 90 seconds, just to expand the menu.
Do you know why this is happening and how to fix it?
thanks
6 个评论
Shameer Parmar
2019-7-1
Hello Alessandro,
So here you can also apply logic to close previous GUI as soon as the new GUI opned.
as your code open one GUI then in next line apply the 'close()' command to close the previously opened GUI, so that it will not create any confusino to you..
so if there are 2 GUIs like GUI1 and GUI2, and GUI1 is already opened and you want to open GUI2 then apply command like this..
GUI2; % for opening GUI2
close(GUI1); %for closing GUI1 and keeping GUI2 as opened..
Please chekc if this can help you..
Alessandro Cicchelero
2019-7-1
Jan
2019-7-1
If it takes 90 seconds to open a menu, something must be computed during this time. The current explanations do not reveal, what it is. Can you post a minimal working example, which reproduces the problem?
Which "menu" are you talking of? One of the figure or a popup menu?
Is the problem reproducible? Do you ran out of memory, such that the slow disk caching blocks the processing?
Alessandro Cicchelero
2019-7-5
Rik
2019-7-5
It might be a tangent, but I wonder if the performance wouldn't improve if callbacks used the normal callback structure of calling a function directly, instead of the wrapping with Main('menu_Callback',hObject,eventdata,guidata(hObject)
Alessandro Cicchelero
2019-7-5
回答(1 个)
Alessandro Cicchelero
2019-7-2
0 个投票
3 个评论
Jan
2019-7-5
"Looking at the profiler seems these 1st and 2nd level uimenu is wasting time only calling the menu callback, and the 99% of the time is self time."
It would be useful to show us the output of te profiler. Currently it is hard to analyse the problem without seeing any details, but only by reading your interpretations.
If the issue does not exist in the given example code, you can use this as point to start: Find out, what the difference is between the example and your real code. Maybe the 2nd fig file contains thousands of graphic objects, which are invisible or hidden behind others. Then finding a specific handle would take a lot of time.
Alessandro Cicchelero
2019-7-5
Jan
2019-7-8
@Alessandro: "The profiler reveals: Self time" does not allow to understand, what's going on. Self time of what? "this is generated by the listener management" - what is generated?
As long, as the posted code does not reproduce the observed behavior, I do not see a reason to assume, that there is a hard limit in the number of listeners.
Currently the problem has not been explained in a way, which allows to understand or reproduce it.
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Mobile Fundamentals 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!