title: What is the difference between revolutions and iterations in phpbench?
body: <p>I already read <a href="https://phpbench.readthedocs.io/en/latest/annotributes.html" rel="nofollow noreferrer">the documentation</a>, but when testing, I'm still not able to understand well the difference between them.</p>
  <p>For example, with this simple file:</p>
  <pre><code>&lt;?php
      class StackOverflowBench
      {
          public function benchNothing()
          {
          }
      }
  </code></pre>
  <p>When I set 1000 revolutions, and only one iteration, here is my result:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>subject</th>
  <th>set</th>
  <th>revs</th>
  <th>its</th>
  <th>mem_peak</th>
  <th>best</th>
  <th>mean</th>
  <th>mode</th>
  <th>worst</th>
  <th>stdev</th>
  <th>rstdev</th>
  <th>diff</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>benchNothing</td>
  <td>0</td>
  <td>10000</td>
  <td>1</td>
  <td>2,032,328b</td>
  <td>10.052μs</td>
  <td>10.052μs</td>
  <td>10.052μs</td>
  <td>10.052μs</td>
  <td>0.000μs</td>
  <td>0.00%</td>
  <td>1.00x</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>the <code>best</code>, <code>mean</code>, <code>mode</code> and <code>worst</code> are always the same, which means they are based on the only iteration I made.</p>
  <p>When I run it with 10 revolutions and still 1 iteration, I have this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>subject</th>
  <th>set</th>
  <th>revs</th>
  <th>its</th>
  <th>mem_peak</th>
  <th>best</th>
  <th>mean</th>
  <th>mode</th>
  <th>worst</th>
  <th>stdev</th>
  <th>rstdev</th>
  <th>diff</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>benchNothing</td>
  <td>0</td>
  <td>10</td>
  <td>1</td>
  <td>2,032,328b</td>
  <td>10.200μs</td>
  <td>10.200μs</td>
  <td>10.200μs</td>
  <td>10.200μs</td>
  <td>0.000μs</td>
  <td>0.00%</td>
  <td>1.00x</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>which seems to mean the times calculated are not a sum of all the revolutions, but something like an average for each iteration.</p>
  <p>If I wanted to measure the best and worst execution time of each time the method is executed, I'd try 1000 iterations and only 1 revolution each, but it takes waay to much time. I launched it with 100 iterations of 1 revolution, here's the result :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>subject</th>
  <th>set</th>
  <th>revs</th>
  <th>its</th>
  <th>mem_peak</th>
  <th>best</th>
  <th>mean</th>
  <th>mode</th>
  <th>worst</th>
  <th>stdev</th>
  <th>rstdev</th>
  <th>diff</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>benchNothing</td>
  <td>0</td>
  <td>1</td>
  <td>100</td>
  <td>2,032,328b</td>
  <td>20.000μs</td>
  <td>25.920μs</td>
  <td>25.196μs</td>
  <td>79.000μs</td>
  <td>5.567μs</td>
  <td>21.48%</td>
  <td>1.00x</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>This time, the time seems to be at least twice as long, and I'm wondering what I didn't understand well. I may be using these informations badly (I know my last example is a wrong one).</p>
  <p>Is it necessary to measure the best and worst of each revolution, like I want to do ?
  What are the interests of iterations ?</p>