MATLAB Answers

Why is the rectangle command so much slower on the new graphics engine?

2 views (last 30 days)
Johannes Korsawe
Johannes Korsawe on 28 Apr 2016
Answered: Walter Roberson on 28 Apr 2016
Hi folks,
i am just comparing the performance in plotting a lot of filled circles via the rectangle command. My benchmark is Release 2010b and i want to switch to Release 2015b.
I could not believe that i found 2015b being 5 times slower! Same machine, same renderer. (Doesn't depend on the renderer, though.)
Here is my example code including time measurement.
z=0;
for exp=1:0.2:5,
n=round(10^exp);cntr=rand(n,2);rad=rand(n,1);z=z+1;figure;hold on;set(gcf,'Renderer','opengl');
t1=clock;
for i=1:n,
h=rectangle('Position',[cntr(i,1)-rad(i),cntr(i,2)-rad(i),2*rad(i),2*rad(i)],'Curvature',[1,1],'FaceColor','b','EdgeColor','none');
end
t2=clock;result(z)=etime(t2,t1);nn(z)=n;delete(gcf);
end
Who has an idea to draw so many filled(!) circles (patches or anything, not pure lines as in viscircles) at a competetive speed also in 2015b?
For a major application of mine this really is a big drawback!

Community Treasure Hunt

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

Start Hunting!