Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!d45g2000hsc.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: much faster MATLAB
Date: Tue, 7 Oct 2008 07:33:20 -0700 (PDT)
Organization: http://groups.google.com
Lines: 48
Message-ID: <5b415775-2638-43ed-a84a-6de4ebeea927@d45g2000hsc.googlegroups.com>
References: <gcebi7$otk$1@fred.mathworks.com>
NNTP-Posting-Host: 212.17.141.54
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1223390000 23844 127.0.0.1 (7 Oct 2008 14:33:20 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 7 Oct 2008 14:33:20 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: d45g2000hsc.googlegroups.com; posting-host=212.17.141.54; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:494061


On 7 Okt, 02:47, "Kevin Johnson" <defer....@gmail.com> wrote:
> All,
>
> I have been using MATLAB for many years now but finally its speed has bec=
ome a major limiting factor. =A0As time has gone on, large segments of my c=
ode are no longer in need of further development (though other segments are=
). These same segments are the ones that consume most of the computation ti=
me.

You might want to profile the code and see exactky where the
bottlenecks are. After that, you might want to look into the
time-consuming parts and see what goes on in there. If they
are plain-vanilla matrix operations there is likely not much
you can do to speed things up - you might possibly gain something
by using parallel libraries in a multi-core CPU, depending on
your present hardware. If you findbottlenecks in I/O, work flow
organization etc, you can expect 10x improvment if you switch
to a language like C++.

> 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, i=
t sounds daunting for a basically amateur (in terms of skills) programmer l=
ike me.

It's for sure not something to be taken lightly. On the
other hand, you will not find any better motivation to
learn than your present frustration.

> In a broad sense, what would be the best approach to substantially (at le=
ast 10x) speed up these unchanging swaths of code, for someone who is not a=
 programmer? =A0I'd be able to invest in a solution within reason.

If you are not a programmer by training yourself, then you
might want to consult somebody who is. It takes time and
dedication to learn how to program efficiently, and it might
be too large a commitment to take on, if you only want to
modify some existing code.

If somebody seriously considers to learn Fortran or C in order
to program MEX files, I would suggest they consider C++. It is
a far more flexible language than either Fortran or C, so one
can do far more advanced stuff, and everything is way easier.

The downside with C++ is that one needs a C++ compiler to use
with matlab (matlab comes with a C compiler), and C++ takes
a long time to learn.

Rune