title: is there a way to enable optimization for local clang++ on mac?
body: <p>this question is derived from that <a href="https://stackoverflow.com/q/56552706/10443608">post</a>.</p>
  
  <p>it seems that the online <a href="http://cpp.sh/7yzcp" rel="nofollow noreferrer">compiler</a> discard this function while optimizing.</p>
  
  <pre><code>void functiona()
  {
      long long number = 0;
      // long long problemSize = 100000000000;
      long long problemSize = 10;
  
      for( long long i = 0; i &lt; problemSize; ++i )
      {
         for(long long j = 0; j &lt; problemSize; j++)
         {
             for(long long k = 0; k &lt; problemSize; k++)
             {
                 for(long long l = 0; l &lt; problemSize; l++)
                 {
                     for(long long l = 0; l &lt; problemSize; l++)
                     {
                         number++;
                         number--;
                     }
                 }
              }
          }
      }
  }
  </code></pre>
  
  <p>compiling <a href="http://cpp.sh/7yzcp" rel="nofollow noreferrer">this piece of code</a> on my local mac </p>
  
  <pre><code>clang++ -std=c++11 -stdlib=libc++ benchmark.cpp
  
  ./a.out
  409
  </code></pre>
  
  <p>seems to be without optimization.</p>
  
  <p>this <a href="https://stackoverflow.com/questions/15548023/clang-optimization-levels">post</a> and <a href="https://clang.llvm.org/docs/ClangCommandLineReference.html#optimization-level" rel="nofollow noreferrer">doc</a> provide some info about clang optimization.</p>
  
  <p>is there a way to enable optimization for clang++, so that the local output is close to online one.</p>