MATLAB Answers

Will Roe

Why is Matlab slow with large objects in the workspace even when RAM is not limited?

Will Roe
さんによって質問されました 2019 年 1 月 8 日
最新アクティビティ Will Roe
さんによって コメントされました 2019 年 1 月 8 日
I'm running Matlab on a machine with 200 GB of ram, yet Matlab slows down horribly when I store large (~10GB) objects in the workspace.
To test, I've tried running tic; 1+1; toc.
This snippet sometimes runs nearly instantaneously (as one would expect) but often takes minutes! I cannot discern a pattern in the runtime--it seems random. However, even when it runs slowly (5 min for example), toc still shows that it ran in milliseconds. While the command is running, I'm able to use the computer and Matlab normally (except the command window of course.)
Scripts also run extremely slowly.
How can I speed things up?

  0 件のコメント

サインイン to comment.




2 件の回答

回答者: Philip Borghesani 2019 年 1 月 8 日

Close the workspace browser or hide its tab. It may be that changing the workspace preference for calculating statistical values to a smaller number will help.
After running any code, but before returning to the command line, anytime a base workspace variable could have changed (usually scripts or commands) the workspace browser needs to refresh its list of variables, values and statistics including variable size. For large object structures or cell arrays this can take a long time to determine.

  0 件のコメント

サインイン to comment.

回答者: Steven Lord
2019 年 1 月 8 日

Do you have the Workspace window open showing the properties of the large object? What happens if you close the Workspace window (leaving the object in the workspace, but not showing its properties) and rerun the tic / toc command?

  1 件のコメント

Will Roe
2019 年 1 月 8 日
Wow!! Problem solved, thank you!

サインイン to comment.

Translated by