MATLAB: Is GUI performance slower in MATLAB 7.7 (R2008b) when compared to MATLAB 7.6 (R2007a)

animationgetMATLABrenderset

I have a script file which creates a figure of specific dimensions and then increases its size. This increase in size is performed in steps which results in an "animation effect". The execution time of this script in R2007a is nearly 30-40 times faster than in R2008b.
f = figure('units', 'char', 'pos', [30 30 60 30]);
drawnow;
tic
for i = 1:15
%Increment the height of the GUI
GUIPosition = get(f, 'Position');
GUIPosition(1,4) = GUIPosition(1,4)+1; %Increment the height
GUIPosition(1,2) = GUIPosition(1,2)-0.5; %Decrement the y-pos
set(f, 'Position', GUIPosition);
end
toc
pause(1); close(f);

Best Answer

The delay is primarily because of the time for execution of the GET function to retrieve the position of the figure in R2008b is greater than in R2007a. This was introduced while refactoring the code to return more accurate values.
As a workaround, one can call the GET function before the FOR-loop. This greatly improves the speed. In fact the performance is now faster than R2007a.
Related Question