Patch Rendering Performance R2025a vs R2021b

58 ビュー (過去 30 日間)
Alexander Jöhl
Alexander Jöhl 2025 年 6 月 14 日
回答済み: Meet 2025 年 6 月 17 日
I use patch() often for simple realtime visualization of robots in our machines.
Until now we have worked with Matlab R2021b. I am looking at Matlab R2025a for evaluation.
The newer release seems to be slower at rendering patches than the older release. I made a simple script to test this, see below.
On my computer, the script has the following running time:
R2021b: 5.1 seconds
R2025a: 7.1 seconds
Why is the newer version slower? Do I need to handle patch() differently for better performance? Any suggestions?
close all
p = patch('XData', rand(100,1),'YData',rand(100,1),'ZData',rand(100,1));
view(3)
tic()
for idx = 1:100
p.XData = rand(100,1);
p.YData = rand(100,1);
p.ZData = rand(100,1);
drawnow();
end
toc()
  5 件のコメント
Walter Roberson
Walter Roberson 2025 年 6 月 17 日
I had the hypothesis that perhaps rand() was slower, so I tried preallocating XD = rand(100,100); and likewise YD and ZD, and then P.XData = rand(:,idx); and similar. The resulting code ran a bit slower on R2025a.
Alexander Jöhl
Alexander Jöhl 2025 年 6 月 17 日
I assumed that rand() timing is negligible, because I ran the code above but with drawnow() commented out and it took about 0.01 seconds.

サインインしてコメントする。

採用された回答

Meet
Meet 2025 年 6 月 17 日
Hi Alexander,
I tested the code in both MATLAB R2025a and R2021b. The R2025a version was about 2 seconds slower than R2021b. However, when I ran the code with the "drawnow" command commented out, both versions took roughly the same amount of time. I believe the slower rendering of "patch()" in MATLAB R2025a compared to R2021b is mainly due to a significant change in the graphics rendering system introduced in R2025a. Specifically, MATLAB shifted from its previous Java-based graphics engine to a new WebGL-based system.
For more information on the new graphics rendering system refer the following MathWorks blog: https://blogs.mathworks.com/graphics-and-apps/2025/06/10/introducing-the-new-graphics-and-app-building-system-in-matlab-r2025a/
I would also recommend reaching out to MathWorks Technical Support regarding this query:
Hope this helps!!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by