Memory Vs Code

조회 수: 1 (최근 30일)
Shani Gal
Shani Gal 2012년 4월 9일
Hi
I have a program that manipulates a large matrix size A=[1e6,5]
And I was wondering if running the code twice on a small matrix lets say A1=[0.5e6,5] and A2=[0.5e6,5] will be faster than running the code on the original matrix?
How can I found out before making changes to the code?
Thanks
Shani

답변 (1개)

Daniel Shub
Daniel Shub 2012년 4월 9일
Unfortunately, there is no way to know before making changes. It really depends on what your are doing. MATLAB has a number of optimizations that kick in for various size matrices. For example, if you are doing identical processing on each column, MATLAB very well could utilize multithreading. You can read up on what functions MATLAB multithreads, but my take is that the list is not complete and sometimes wrong.
  댓글 수: 1
Jan
Jan 2012년 4월 10일
Even the best documentation cannot answer such questions, because there are a lot of dependencies to disk speed, cache size, memory size and speed, number of (virtual) processors, concurrent tasks, programming problems like false cache sharing, etc. The only reliable method to estimate the speed gain of multi-threading is implementing both versions and compare them. Most of all if the program should run on different machines, it is even useful to keep both versions, such that the user can make the decision. Unfortunately, this means that two version must be maintained and fixing bugs will be dangerous.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by