title: *str and *str++
body: <p>I have this code (my strlen function)</p>
  
  <pre><code>size_t slen(const char *str)
  {
      size_t len = 0;
      while (*str)
      {
          len++;
          str++;
      }
      return len;
  }
  </code></pre>
  
  <p>Doing <code>while (*str++)</code>, as shown below, the program execution time is much larger:</p>
  
  <pre><code>while (*str++)
  {
      len++;
  }
  </code></pre>
  
  <p>I'm doing this to probe the code</p>
  
  <pre><code>int main()
  {
      double i = 11002110;
      const char str[] = "long string here blablablablablablablabla"
      while (i--)
          slen(str);
  
      return 0;
  }
  </code></pre>
  
  <p>In first case the execution time is around 6.7 seconds, while in the second (using <code>*str++</code>), the time is around 10 seconds!</p>
  
  <p>Why so much difference?</p>