title: PHP 7 Performance
body: <p>I've tried to reproduce this benchmark which compares PHP 7 with older versions on a Wordpress server: <a href="http://talks.php.net/oz15#/wpbench" rel="nofollow noreferrer">http://talks.php.net/oz15#/wpbench</a></p>
  
  <p>My configuration is nearly the same, the server has an i7, SSD, 16GB RAM and debian. The server software is nginx. Suprisingly my results differ a lot from the ones linked above. </p>
  
  <p>In my tests Siege (<a href="https://www.joedog.org/siege-home/" rel="nofollow noreferrer">https://www.joedog.org/siege-home/</a>) outputs the following:</p>
  
  <p><strong>For PHP 7.0.0RC1:</strong></p>
  
  <pre><code>siege -c100 -r100 http://10.22.255.133/wordpress/
  ** SIEGE 3.0.8
  ** Preparing 100 concurrent users for battle.
  The server is now under siege..      done.
  
  Transactions:                  10000 hits
  Availability:                  100.00 %
  Elapsed time:                  131.61 secs
  Data transferred:              95.77 MB
  Response time:                 0.75 secs
  Transaction rate:              75.98 trans/sec
  Throughput:                    0.73 MB/sec
  Concurrency:                   56.98
  Successful transactions:       10000
  Failed transactions:           0
  Longest transaction:           1.01
  Shortest transaction:          0.04
  </code></pre>
  
  <p><strong>For PHP 5.6.12:</strong></p>
  
  <pre><code>siege -c100 -r100 http://10.22.255.133/wordpress/
  ** SIEGE 3.0.8
  ** Preparing 100 concurrent users for battle.
  The server is now under siege..      done.
  
  Transactions:                  10000 hits
  Availability:                  100.00 %
  Elapsed time:                  63.41 secs
  Data transferred:              95.77 MB
  Response time:                 0.03 secs
  Transaction rate:              157.70 trans/sec
  Throughput:                    1.51 MB/sec
  Concurrency:                   4.45
  Successful transactions:       10000
  Failed transactions:           0
  Longest transaction:           0.63
  Shortest transaction:          0.01
  </code></pre>
  
  <p>When looking at the transaction rate you can see, that PHP 5 is about two times faster than PHP 7. I can't believe that. </p>
  
  <p>Another interesting fact is, that running this benchmark (<a href="http://www.php-benchmark-script.com/" rel="nofollow noreferrer">http://www.php-benchmark-script.com/</a>) results in PHP 7 being about 3 times faster than PHP 5 (of course on the same server where I've also tested Wordpress). The measured results were:</p>
  
  <ul>
  <li><strong>PHP 7.0.0RC1 | PHP 5.5.28</strong></li>
  <li><em>Math:</em> 0.201 | 0.683</li>
  <li><em>String Manipulation:</em> 0.271 | 0.77</li>
  <li><em>Loops:</em> 0.166 | 0.486</li>
  <li><em>If Else:</em> 0.12 | 0.295</li>
  </ul>
  
  <p>I've uploaded both phpinfo() files in case that helps:</p>
  
  <ul>
  <li>PHP Version 7.0.0RC1: <a href="http://simsso.de/downloads/stackoverflow/php7.html" rel="nofollow noreferrer">http://simsso.de/downloads/stackoverflow/php7.html</a></li>
  <li>PHP Version 5.6.12-0+deb8u1: <a href="http://simsso.de/downloads/stackoverflow/php5.html" rel="nofollow noreferrer">http://simsso.de/downloads/stackoverflow/php5.html</a></li>
  </ul>
  
  <p>Do you have any idea why PHP 7 is that much slower in my tests with Wordpress?</p>
  
  <hr>
  
  <p>With <strong>opcache enabled</strong> PHP 7 is actually twice as fast as PHP 5. Thanks Mjh for your hint!</p>
  
  <p>I've made the following measurements on a randomly filled WordPress Server.</p>
  
  <p>Siege now outputs the following for <strong>PHP 7.0.0RC1</strong>:</p>
  
  <pre><code>Transactions:                  10000 hits
  Availability:                 100.00 %
  Elapsed time:                  62.14 secs
  Data transferred:             604.20 MB
  Response time:                  0.02 secs
  Transaction rate:             160.93 trans/sec
  Throughput:                     9.72 MB/sec
  Concurrency:                    3.77
  Successful transactions:       10000
  Failed transactions:               0
  Longest transaction:            0.41
  Shortest transaction:           0.01 
  </code></pre>
  
  <p>And <strong>PHP 5.6.12</strong>:</p>
  
  <pre><code>siege -c100 -r100 http://10.22.255.133/wordpress/
  ** SIEGE 3.0.8
  ** Preparing 100 concurrent users for battle.
  The server is now under siege..      done.
  
  Transactions:                 10000 hits
  Availability:                 100.00 %
  Elapsed time:                 119.98 secs
  Data transferred:             604.20 MB
  Response time:                0.60 secs
  Transaction rate:             83.35 trans/sec
  Throughput:                   5.04 MB/sec
  Concurrency:                  49.86
  Successful transactions:      10000
  Failed transactions:          0
  Longest transaction:          4.06
  Shortest transaction:         0.04
  </code></pre>