<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/154137</link>
    <title>MATLAB Central Newsreader - Optimization of functions delivered by MATLAB</title>
    <description>Feed for thread: Optimization of functions delivered by MATLAB</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 08 Aug 2007 08:55:45 -0400</pubDate>
      <title>Optimization of functions delivered by MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/154137#386723</link>
      <author>Markus Buehren</author>
      <description>Hi!&lt;br&gt;
&lt;br&gt;
Occasionally I look into m-functions which are shipped with&lt;br&gt;
Matlab and which are extremely often called in my code.&lt;br&gt;
Often I find huge space for improvement. Let me give an&lt;br&gt;
example with the function tripuls of the signal processing&lt;br&gt;
toolbox (I don't know if I am allowed to post the code&lt;br&gt;
here). It takes up to three arguments, but I never use the&lt;br&gt;
third one. Anyway, the default parameter value is used in&lt;br&gt;
the computations, causing unnecessary divisions and more. I&lt;br&gt;
have written the following replacement which is much faster&lt;br&gt;
when not using the third input argument: &lt;br&gt;
&lt;br&gt;
error(nargchk(1,3,nargin));&lt;br&gt;
if nargin &amp;lt; 2&lt;br&gt;
&amp;nbsp;&amp;nbsp;y = max(0, 1-2*abs(t));&lt;br&gt;
elseif nargin &amp;lt; 3&lt;br&gt;
&amp;nbsp;&amp;nbsp;y = max(0, 1-2*abs(t)/Tw);&lt;br&gt;
else&lt;br&gt;
&amp;nbsp;&amp;nbsp;y = tripuls(t, Tw, skew);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Ok, let me get to the point. Are there people at The&lt;br&gt;
Mathworks involved with skimming through all files, looking&lt;br&gt;
for possible optimizations in order to speed up Matlab a&lt;br&gt;
little bit from one release to another? If not, would The&lt;br&gt;
Mathworks pay me for doing this as a freelancer? :-)&lt;br&gt;
&lt;br&gt;
Regards&lt;br&gt;
Markus</description>
    </item>
    <item>
      <pubDate>Wed, 08 Aug 2007 11:28:24 -0400</pubDate>
      <title>Re: Optimization of functions delivered by MATLAB</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/154137#386760</link>
      <author>John D'Errico</author>
      <description>&quot;Markus Buehren&quot; &amp;lt;mb_matlabREMOVE@gmxTHIS.de&amp;gt; wrote in message &lt;br&gt;
&amp;lt;f9c0eh$rft$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;nbsp;&lt;br&gt;
&amp;gt; Ok, let me get to the point. Are there people at The&lt;br&gt;
&amp;gt; Mathworks involved with skimming through all files, looking&lt;br&gt;
&amp;gt; for possible optimizations in order to speed up Matlab a&lt;br&gt;
&amp;gt; little bit from one release to another?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
No, I doubt that there are people whos only job&lt;br&gt;
is to constantly revisit all existing code, looking for&lt;br&gt;
tweaks. If someone notices something that is&lt;br&gt;
obviously bad, or if a comment comes in that&lt;br&gt;
brings something to attention, yes they will&lt;br&gt;
happily repair it. The fact is, any code that is&lt;br&gt;
composed of millions of lines will have some&lt;br&gt;
inefficiencies, some fragments that could be&lt;br&gt;
improved.&lt;br&gt;
&lt;br&gt;
As the author of many pieces of software, I can&lt;br&gt;
point to tools that I wrote and rewrote many&lt;br&gt;
times over many years, enhancing them each&lt;br&gt;
time as I saw new tricks I could apply. But I can&lt;br&gt;
assure you that many of the speed boosts that I&lt;br&gt;
found would never have been turned up by some&lt;br&gt;
random code screener.&lt;br&gt;
&lt;br&gt;
The Mathworks pays their employees to know&lt;br&gt;
the language, and know efficient ways to code in&lt;br&gt;
that language. Plus they go through code reviews&lt;br&gt;
of any code before it goes out, that will catch&lt;br&gt;
most of the obvious problems. I'll bet they even&lt;br&gt;
use mlint on their own code.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; If not, would The&lt;br&gt;
&amp;gt; Mathworks pay me for doing this as a freelancer? :-)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
No, I don't expect that TMW will pay you as a&lt;br&gt;
freelance debugger and optimizer of their codes.&lt;br&gt;
You can send in a bug report if you find a bug, or&lt;br&gt;
an enhancement request if you see potential for&lt;br&gt;
improvement. Or you can apply for a job formally&lt;br&gt;
with their organization.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
  </channel>
</rss>

