Thread Subject: Optimization of functions delivered by MATLAB

Subject: Optimization of functions delivered by MATLAB

From: Markus Buehren

Date: 8 Aug, 2007 08:55:45

Message: 1 of 2

Hi!

Occasionally I look into m-functions which are shipped with
Matlab and which are extremely often called in my code.
Often I find huge space for improvement. Let me give an
example with the function tripuls of the signal processing
toolbox (I don't know if I am allowed to post the code
here). It takes up to three arguments, but I never use the
third one. Anyway, the default parameter value is used in
the computations, causing unnecessary divisions and more. I
have written the following replacement which is much faster
when not using the third input argument:

error(nargchk(1,3,nargin));
if nargin < 2
  y = max(0, 1-2*abs(t));
elseif nargin < 3
  y = max(0, 1-2*abs(t)/Tw);
else
  y = tripuls(t, Tw, skew);
end

Ok, let me get to the point. Are there people at The
Mathworks involved with skimming through all files, looking
for possible optimizations in order to speed up Matlab a
little bit from one release to another? If not, would The
Mathworks pay me for doing this as a freelancer? :-)

Regards
Markus

Subject: Optimization of functions delivered by MATLAB

From: John D'Errico

Date: 8 Aug, 2007 11:28:24

Message: 2 of 2

"Markus Buehren" <mb_matlabREMOVE@gmxTHIS.de> wrote in message
<f9c0eh$rft$1@fred.mathworks.com>...
 
> Ok, let me get to the point. Are there people at The
> Mathworks involved with skimming through all files, looking
> for possible optimizations in order to speed up Matlab a
> little bit from one release to another?


No, I doubt that there are people whos only job
is to constantly revisit all existing code, looking for
tweaks. If someone notices something that is
obviously bad, or if a comment comes in that
brings something to attention, yes they will
happily repair it. The fact is, any code that is
composed of millions of lines will have some
inefficiencies, some fragments that could be
improved.

As the author of many pieces of software, I can
point to tools that I wrote and rewrote many
times over many years, enhancing them each
time as I saw new tricks I could apply. But I can
assure you that many of the speed boosts that I
found would never have been turned up by some
random code screener.

The Mathworks pays their employees to know
the language, and know efficient ways to code in
that language. Plus they go through code reviews
of any code before it goes out, that will catch
most of the obvious problems. I'll bet they even
use mlint on their own code.


> If not, would The
> Mathworks pay me for doing this as a freelancer? :-)


No, I don't expect that TMW will pay you as a
freelance debugger and optimizer of their codes.
You can send in a bug report if you find a bug, or
an enhancement request if you see potential for
improvement. Or you can apply for a job formally
with their organization.

John

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
builtin mathworks Markus Buehren 8 Aug, 2007 05:00:19
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com