What is TextContro​l>TextCont​rol.proces​s listed when profiling appdesigner code (Matlab 2021b)?

13 次查看(过去 30 天)
I am writing an application using appdesigner in Matlab 2021b. I have been using the profiler to understand how to improve the response times of the application display, and the most time consuming function name is always listed as 'TextControl>TextControl.process' as follows:
To improve the response time of my application, I have been reducing the number of calls to plot() and text(), and this has been quite helpful. But I am finding this 'TextControl' function calls entry hard to understand, so it is not so easy to progress further. Any suggestions would be appreciated.
  10 个评论
Nick Bennett
Nick Bennett 2024-10-1
Thank you very much for your observations. Most instructive and informative. I already have selectively been cutting down on the number of text labels I have been using which has been helpful.
Also, when I vectorize the addition of text and box placement when redrawing the UI, I am seeing about a factor of 10 speed up (~roughly 45-50 seconds down to about 5 seconds), but I still see the same overhead. That is, I do better with shortening the blue bars in my flame diagram above and below here, but still see the same overhead.
I was studying the flame diagram more closely. It is quite logical now that I am spending more time with it. It more or less divides into 3 parts. The first part circled in red is where all my text boxes seem to be responding in some fashion to my UI change (move a slider bar or click a menu item), then I am redrawing my two axes (indicated in green), and then there is a registration section of sorts that I am circling in purple. I've blown up that third section in the next figure.
Here we clearly see that there is some registration of text control. Hard for me to understand what is happening here.
As you already highlighted, these behaviors seem to be coming from how I am designing my UI in appdesigner.
When I am reading the documentation about Text Properties, specifically the section on Interactivity, I am seeing properties for 'Editing' which is by default 'off', 'Visible' which is by default 'on' (that's good), 'ConextMenu' which is 'empty' by default, 'Selected' which is 'off' by default, 'selectionHighlight' which is 'on', and 'Interactions' which is empty by default.
I typically try to avoid getting into the weeds of these kinds of settings but I will look through this some more.
dpb
dpb 2024-10-1
"..., 'Visible' which is by default 'on' (that's good),"
One thing that is a trick in speeding up (apparent) response time with graphics is actually to draw into a hidden axes ('Visible','off') and then, when finished, make it the visible and hide/delete the previous. With the graphics visible, the background processes to cause screen updates will trigger whenever anything gets modified whereas if it is not visible, then the engine knows there is no need to actually refresh the screen. I've never tried this inside AppDesigner with its user controls, but if you could manage to arrange the UI such that all you need to update for the interactive controls is in an active panel and all the display information being updated in responsee is in another that can do while invisible and then only make visible when done, you might be able to make some more progress.
If it is feasible to build a very small replica of the idea with sufficient data to be able to illustrate the functionality, upload that .mlapp file and perhaps some others will be inspired to try to look into it more fully. My GUI building has been extremely limited to very small UI interfaces (I was always able to offload that part to others who specialized in those areas while I dealt with the computational side) so my in depth expertise is quite limited...plus, I have some other immediate time-dependent tasks so I really don't have time to delve much more deeply other than what can do in a few minutes' break now and then...

请先登录,再进行评论。

回答(0 个)

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by