title: More on using i and j as variables in Matlab: speed
body: <p>The <a href="http://www.mathworks.es/es/help/matlab/ref/i.html" rel="nofollow noreferrer">Matlab documentation</a> says that</p>
  
  <blockquote>
    <p>For speed and improved robustness, you can replace complex i and j by 1i. For example, instead of using</p>
  
  <pre><code>a = i;
  </code></pre>
    
    <p>use</p>
  
  <pre><code>a = 1i;
  </code></pre>
  </blockquote>
  
  <p>The <em>robustness</em> part is clear, <a href="https://stackoverflow.com/questions/14790740/using-i-and-j-as-variables-in-matlab">as there might be variables called <code>i</code> or <code>j</code></a>. However, as for <em>speed</em>, I have made a simple test in Matlab 2010b and I obtain results which seem to contradict the claim:</p>
  
  <pre><code>&gt;&gt;clear all
  
  &gt;&gt; a=0; tic, for n=1:1e8, a=i; end, toc
  Elapsed time is 3.056741 seconds.
  
  &gt;&gt; a=0; tic, for n=1:1e8, a=1i; end, toc
  Elapsed time is 3.205472 seconds.
  </code></pre>
  
  <p>Any ideas? Could it be a version-related issue?</p>
  
  <p>After comments by @TryHard and @horchler, I have tried assigning other values to the variable <code>a</code>, with these results:</p>
  
  <blockquote>
    <p>Increasing order of elapsed time:</p>
    
    <p>"i" &lt; "1i" &lt; "1*i" (trend "A")</p>
    
    <p>"2i" &lt; "2*1i" &lt; "2*i" (trend "B")</p>
    
    <p>"1+1i" &lt; "1+i" &lt; "1+1*i" (trend "A")</p>
    
    <p>"2+2i" &lt; "2+2*1i" &lt; "2+2*i" (trend "B")</p>
  </blockquote>