Path: news.mathworks.com!not-for-mail
From: "Rodney Thomson" <readmore@iheartmatlab.blogspot.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: much faster MATLAB
Date: Tue, 7 Oct 2008 03:10:24 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <gcejv0$lhu$1@fred.mathworks.com>
References: <gcebi7$otk$1@fred.mathworks.com>
Reply-To: "Rodney Thomson" <readmore@iheartmatlab.blogspot.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1223349024 22078 172.30.248.35 (7 Oct 2008 03:10:24 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 7 Oct 2008 03:10:24 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1430350
Xref: news.mathworks.com comp.soft-sys.matlab:493941


"Kevin Johnson" <defer.jof@gmail.com> wrote in message <gcebi7$otk$1@fred.mathworks.com>...
> All,
> 
> I have been using MATLAB for many years now but finally its speed has become a major limiting factor.  As time has gone on, large segments of my code are no longer in need of further development (though other segments are). These same segments are the ones that consume most of the computation time. 
> 
> Mex files are the solution I suppose; however the last time I programmed in Fortran was 30 years ago, and in C, never. In reading about mex files, it sounds daunting for a basically amateur (in terms of skills) programmer like me. 
> 
> In a broad sense, what would be the best approach to substantially (at least 10x) speed up these unchanging swaths of code, for someone who is not a programmer?  I'd be able to invest in a solution within reason.
> 
> Thanks
> 
>  

Mex files are not always the solution. Improving the MATLAB implementation can offer orders of magnitude increase in performance when a particularly poor choice has been made (ie arrays growing in loops etc).

I would recommend that you run your code through the MATLAB Profiler and identify the regions of poorly performing code. Look at any MLint messages from those code blocks, try and find more efficient implementations of the algorithms.

And sometimes it just takes a certain period of time to do particular operations independent of the implementation language. In that case, buy a faster CPU!

Cheers

Rod

--
http://iheartmatlab.blogspot.com