title: HHVM poor performance
body: <p>I'm evaluating HipHop-PHP for compatibility and performance on our code base, but I'm getting very poor performance when running it with the built-in web server enabled.</p>
  
  <p>I have the following sample test program that calculates a Fibonacci sequence. </p>
  
  <p>ex3.php:</p>
  
  <pre><code>function fib($n)
  {
      if ($n &lt;= 2)
          return 1;
      else
          return fib($n-1) + fib($n-2);
  }
  
  $n = 36;
  printf("fib(%d) = %d\n", $n, fib($n, 2));
  </code></pre>
  
  <p>When I run this through HHVM using the command-line, I get impressive results:</p>
  
  <pre><code>time hhvm -v"Eval.Jit=true" -f ./ex3.php
  fib(36) = 14930352
  
  real    0m0.267s
  user    0m0.248s
  sys     0m0.020s
  </code></pre>
  
  <p>Compare this with standard PHP:</p>
  
  <pre><code>root@hiphop:/www# time php -f ./ex3.php
  fib(36) = 14930352
  
  real    0m5.606s
  user    0m5.600s
  sys     0m0.000s    
  </code></pre>
  
  <p>However, when I want to enable the built-in web server in HHVM, all performance gains are lost:</p>
  
  <pre><code>hhvm -v"Eval.Jit=true" -m server -p 8000 &amp;
  time wget -qSO - http://localhost:8000/ex3.php
    HTTP/1.1 200 OK
    Content-Type: text/html; charset=utf-8
    X-Powered-By: HPHP
    Date: Sat, 27 Jul 2013 14:16:09 GMT
    Content-Length: 19
  fib(36) = 14930352
  
  real    0m5.279s
  user    0m0.000s
  sys     0m0.000s
  </code></pre>
  
  <p>As you can see, I'm getting the response back from HHVM, but it taks more than 5 seconds for it to process this request. What am I missing?</p>