590 Accelerating MATLAB
®
Performance
A technique that I have found useful is to only update the GUI/graphs if a certain
amount of time has passed since the last update, thereby ensuring that only one in N
callbacks will be slow. The user will see the graphs update at a rate of 2–3 times a second,
without any perceptible delay in the other aspects of the mouse callback:
function mouseCallbackFcn(varargin)
persistent lastTime
if isempty(lastTime), lastTime=-1; end
ONE_SEC = 1/(24*60*60);
if now - lastTime > 0.3*ONE_SEC
% do some expensive GUI/graphs update
end
% do some regular inexpensive update
end
There is a slight delay between the time the mouse enters a control’s area and when
the control’s tooltip actually appears. The tool ...