iptPointerManager significantly slows program down
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello MatLabers
As recently I was looking for a method to have a mouse over (mouse hover) effect on my graphics objects (drag lines, select regions in plots, etc.) I found the Image Processing Toolbox to have an iptPointerManager (with iptSetPointerBehavior, etc.).
At first I was very happy with this as now I can show the user which lines are draggable etc. by changing the pointer when his mouse is over it.
I also changed my structural implementation to an object oriented version where I work with some quite an amount of objects (that implement UI, etc.)
Unfortunately when I run my software now, it's terribly slow (at least factor 5..10).
One reason might be the OOP approach (? where I believe the event handling to slow down everything... :( and I use a timer (up to 50Hz) to implement a "Frame Viewer") the other reason definitely is this iptPointerManager - this gets clear by running a profiler on it... the PointerManager is at 90% of the whole time.
Did anyone of you have similar issues or knows a workaround (such that I get back to normal speed)?
(also did I notice that if I drag a line - the CPU usage gets to 50% [max for matlab]... the code used is in the following style:
function positionLineDrag(this, src, eventdata)
set(gcf,'WindowButtonUpFcn', @stopDragginLineFcn);
set(gcf,'WindowButtonMotionFcn',@dragginLineFcn);
...
function dragginLineFcn(varargin)
pt = get(get(src,'Parent'),'CurrentPoint');
...
% notify listeners:
notify(this, 'LinePositionChanged');
end
function stopDragginLineFcn(varargin)
set(gcf,'WindowButtonMotionFcn','');
set(gcf,'Pointer','arrow');
end
end
)
I definitely appreciate any help on this.
Respuestas (1)
Alex Taylor
el 14 de Jun. de 2011
Hi Jonas,
Without having a complete example of your implementation of a draggable line, this is tough to answer, but I'd like to note a few things:
1) iptPointerManager causes graphics events to fire continuously as you move the mouse. I would expect some reduction in performance in your GUI as a result of this. I would not however expect a 5x to 10x reduction in performance.
2) Your profiling results don't tell me what I'd want to know without more context. If all your UI is doing while you are profiling is dispatching pointerManager events as a result of moving the mouse, then I would expect 90% or more of the profile time to be spent in the pointer manager. If a lot of other things are supposed to be happening while you are profiling, then 90% might be unreasonable. Your profiling results don't tell me a complete picture without knowing what your GUI was doing while you were profiling.
3) If you could send me some example code that has a large performance degradation when the pointerManager is installed, I'd be happy to look at this further.
0 comentarios
Ver también
Categorías
Más información sobre Graphics Performance en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!