3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bench { protected $functions = []; protected $cli; public function __construct($cli = false) { $this->cli = $cli; } public function add($label, \Closure $function) { $this->functions[] = [$label, $function]; } public function run($count) { $function = function () {}; $stats = $this->getStats(); for ($i = $count; $i--;) $function(); $stats2 = $this->getStats(); $timeDiff = $stats2[4] - $stats[4]; $this->printStats('Empty test (delta time subtracted from subsequent test)', $stats, $stats2, 0); // TODO: Split runs in pieces and interleave, to avoid bias with first/last runner. foreach ($this->functions as list($label, $function)) { $stats = $this->getStats(); for ($i = $count; $i--;) $function(); $stats2 = $this->getStats(); $this->printStats($label, $stats, $stats2, $timeDiff); } } protected function getStats() { return [memory_get_usage(), memory_get_usage(true), memory_get_peak_usage(), memory_get_peak_usage(true), microtime(1)]; } protected function printStats($label, $stats1, $stats2, $timeDiff) { list($mem, $memReal, $memPeak, $memRealPeak, $time) = $stats1; list($memNew, $memRealNew, $memPeakNew, $memRealPeakNew, $timeNew) = $stats2; $nl = "\n"; $labelLength = 20; $resultsLength = 15; // TODO: Better CLI support. Machine data export. if (PHP_SAPI === 'CLI') { ob_start(); } echo '<p><b>' . $label . '</b></p>' . $nl; echo '<code><p>' . $nl; echo str_pad('Memory', $labelLength, '.', STR_PAD_RIGHT); echo str_pad(number_format(($memNew - $mem) >> 10, 0), $resultsLength, '.', STR_PAD_LEFT) . ' kb<br>' . $nl; echo str_pad('Memory Real', $labelLength, '.', STR_PAD_RIGHT); echo str_pad(number_format(($memRealNew - $memReal) >> 10, 0), $resultsLength, '.', STR_PAD_LEFT) . ' kb<br>' . $nl; echo str_pad('Memory Peak', $labelLength, '.', STR_PAD_RIGHT); echo str_pad(number_format(($memPeakNew - $memPeak) >> 10, 0), $resultsLength, '.', STR_PAD_LEFT) . ' kb<br>' . $nl; echo str_pad('Memory Real Peak', $labelLength, '.', STR_PAD_RIGHT); echo str_pad(number_format(($memRealPeakNew - $memRealPeak) >> 10, 0), $resultsLength, '.', STR_PAD_LEFT) . ' kb<br>' . $nl; echo str_pad('Time', $labelLength, '.', STR_PAD_RIGHT); echo str_pad(number_format($timeNew - $time - $timeDiff, 5), $resultsLength, '.', STR_PAD_LEFT); echo ' sec' . $nl . '</code></p>' . $nl . $nl; if (PHP_SAPI === 'CLI') { $content = ob_end_clean(); echo preg_replace('/<.*?>/', '', $content); } } } class Log { private $has = []; // TODO: Can be replaced with a bitmask. private $events = []; public function __construct() { } /* (non-PHPdoc) * @see \Solver\Logging\Log::log() */ public function log(array $event) { $type = $event['type']; if (!isset($this->has[$type])) $this->has[$type] = true; $this->events[] = $event; } /* (non-PHPdoc) * @see \Solver\Logging\MemoryLog::getEvents() */ public function getEvents($types = null) { if ($types === null || !$this->events) { return $this->events; } else { $types = array_flip($types); // Special optimized case: the given $types mask matches or is a superset of the event types we have. $optimized = true; foreach ($this->has as $key => $val) if (!isset($types[$key])) { $optimized = false; break; } if ($optimized) { return $this->events; } else { $events = []; foreach ($this->events as $event) if (isset($types[$event['type']])) $events[] = $event; return $events; } } } /* (non-PHPdoc) * @see \Solver\Logging\MemoryLog::hasEvents() */ public function hasEvents($types = null) { if ($types === null) { return (bool) $this->has; } else { foreach ($types as $type) if (isset($this->has[$type])) return true; return false; } } /* (non-PHPdoc) * @see \Solver\Logging\ErrorMemoryLog::getErrors() */ public function getErrors() { return $this->getEvents(['error']); } /* (non-PHPdoc) * @see \Solver\Logging\ErrorMemoryLog::hasErrors() */ public function hasErrors() { $o = $this->hasEvents(['error']); $this->events = []; $this->has = []; return $o; } /* (non-PHPdoc) * @see \Solver\Logging\ErrorLog::error() */ public function error($path = null, $message = null, $code = null, array $details = null) { $event = ['type' => 'error']; if (isset($path)) $event['path'] = $path; if (isset($message)) $event['message'] = $message; if (isset($code)) $event['code'] = $code; if (isset($details)) $event['details'] = $details; $this->log($event); } } $log = new Log(); $be = new Bench(true); $be2 = new Bench(); $error = new stdClass(); $a = 0; $b = 0; $be->add('Sentinel', function () use ($error, & $a, & $b) { $x = function ($error) { return mt_rand(0, 1) ? 123 : $error; }; $result = $x($error); if ($result === $error) { $a ++; } else { $b ++; } }); $be->add('Tuple', function () use (& $a, & $b) { $x = function () { return mt_rand(0, 1) ? [true, 123] : [false, null]; }; list($error, $result) = $x(); if ($error) { $a ++; } else { $b ++; } }); $be->add('Exception', function () use (& $a, & $b) { $x = function () { if (mt_rand(0, 1)) throw new \Exception(); return 123; }; try { $result = $x(); $a ++; } catch (\Exception $e) { $b ++; } }); $be->add('Log', function () use ($log, & $a, & $b) { $x = function ($log) { if (mt_rand(0, 1)) { $log->error(); return null; } else { return 123; } }; $result = $x($log); if ($log->hasErrors()) { $a ++; } else { $b ++; } }); if (PHP_VERSION === '7.0.0RC4') $be->run(200000); var_dump($a); var_dump($b);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 49
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/d9HiW
function name:  (null)
number of ops:  56
compiled vars:  !0 = $log, !1 = $be, !2 = $be2, !3 = $error, !4 = $a, !5 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  162     0  E >   NEW                                              $6      'Log'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
  164     3        NEW                                              $9      'Bench'
          4        SEND_VAL_EX                                              <true>
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $9
  165     7        NEW                                              $12     'Bench'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $12
  167    10        NEW                                              $15     'stdClass'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !3, $15
  169    13        ASSIGN                                                   !4, 0
  170    14        ASSIGN                                                   !5, 0
  172    15        INIT_METHOD_CALL                                         !1, 'add'
         16        SEND_VAL_EX                                              'Sentinel'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A172%241'
         18        BIND_LEXICAL                                             ~20, !3
         19        BIND_LEXICAL                                             ~20, !4
         20        BIND_LEXICAL                                             ~20, !5
  183    21        SEND_VAL_EX                                              ~20
         22        DO_FCALL                                      0          
  185    23        INIT_METHOD_CALL                                         !1, 'add'
         24        SEND_VAL_EX                                              'Tuple'
         25        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A185%243'
         26        BIND_LEXICAL                                             ~22, !4
         27        BIND_LEXICAL                                             ~22, !5
  196    28        SEND_VAL_EX                                              ~22
         29        DO_FCALL                                      0          
  198    30        INIT_METHOD_CALL                                         !1, 'add'
         31        SEND_VAL_EX                                              'Exception'
         32        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A198%245'
         33        BIND_LEXICAL                                             ~24, !4
         34        BIND_LEXICAL                                             ~24, !5
  210    35        SEND_VAL_EX                                              ~24
         36        DO_FCALL                                      0          
  212    37        INIT_METHOD_CALL                                         !1, 'add'
         38        SEND_VAL_EX                                              'Log'
         39        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A212%247'
         40        BIND_LEXICAL                                             ~26, !0
         41        BIND_LEXICAL                                             ~26, !4
         42        BIND_LEXICAL                                             ~26, !5
  228    43        SEND_VAL_EX                                              ~26
         44        DO_FCALL                                      0          
  230    45      > JMPZ                                                     <false>, ->49
  231    46    >   INIT_METHOD_CALL                                         !1, 'run'
         47        SEND_VAL_EX                                              200000
         48        DO_FCALL                                      0          
  233    49    >   INIT_FCALL                                               'var_dump'
         50        SEND_VAR                                                 !4
         51        DO_ICALL                                                 
  234    52        INIT_FCALL                                               'var_dump'
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A16%240

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A172%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $error, !1 = $a, !2 = $b, !3 = $x, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  172     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
  173     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A173%242'
          4        ASSIGN                                                   !3, ~5
  177     5        INIT_DYNAMIC_CALL                                        !3
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !4, $7
  178     9        IS_IDENTICAL                                             !4, !0
         10      > JMPZ                                                     ~9, ->13
  179    11    >   PRE_INC                                                  !1
         12      > JMP                                                      ->14
  181    13    >   PRE_INC                                                  !2
  183    14    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A172%241

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A173%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  173     0  E >   RECV                                             !0      
  174     1        INIT_FCALL                                               'mt_rand'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->8
          6    >   QM_ASSIGN                                        ~2      123
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~2      !0
          9    > > RETURN                                                   ~2
  175    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A173%242

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A185%243:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $x, !3 = $error, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  185     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
  186     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A186%244'
          3        ASSIGN                                                   !2, ~5
  190     4        INIT_DYNAMIC_CALL                                        !2
          5        DO_FCALL                                      0  $7      
          6        FETCH_LIST_R                                     $8      $7, 0
          7        ASSIGN                                                   !3, $8
          8        FETCH_LIST_R                                     $10     $7, 1
          9        ASSIGN                                                   !4, $10
         10        FREE                                                     $7
  191    11      > JMPZ                                                     !3, ->14
  192    12    >   PRE_INC                                                  !0
         13      > JMP                                                      ->15
  194    14    >   PRE_INC                                                  !1
  196    15    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A185%243

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A186%244:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  187     0  E >   INIT_FCALL                                               'mt_rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $0      
          4      > JMPZ                                                     $0, ->7
          5    >   QM_ASSIGN                                        ~1      <array>
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~1      <array>
          8    > > RETURN                                                   ~1
  188     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A186%244

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A198%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b, !2 = $x, !3 = $result, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  198     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
  199     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A199%246'
          3        ASSIGN                                                   !2, ~5
  205     4        INIT_DYNAMIC_CALL                                        !2
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !3, $7
  206     7        PRE_INC                                                  !0
          8      > JMP                                                      ->11
  207     9  E > > CATCH                                       last         'Exception'
  208    10    >   PRE_INC                                                  !1
  210    11    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A198%245

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A199%246:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  200     0  E >   INIT_FCALL                                               'mt_rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $0      
          4      > JMPZ                                                     $0, ->8
          5    >   NEW                                              $1      'Exception'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $1
  201     8    > > RETURN                                                   123
  202     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A199%246

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A212%247:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $log, !1 = $a, !2 = $b, !3 = $x, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  212     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
  213     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A213%248'
          4        ASSIGN                                                   !3, ~5
  222     5        INIT_DYNAMIC_CALL                                        !3
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !4, $7
  223     9        INIT_METHOD_CALL                                         !0, 'hasErrors'
         10        DO_FCALL                                      0  $9      
         11      > JMPZ                                                     $9, ->14
  224    12    >   PRE_INC                                                  !1
         13      > JMP                                                      ->15
  226    14    >   PRE_INC                                                  !2
  228    15    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A212%247

Function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A213%248:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $log
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  213     0  E >   RECV                                             !0      
  214     1        INIT_FCALL                                               'mt_rand'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->10
  215     6    >   INIT_METHOD_CALL                                         !0, 'error'
          7        DO_FCALL                                      0          
  216     8      > RETURN                                                   null
          9*       JMP                                                      ->11
  218    10    > > RETURN                                                   123
  220    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd9HiW%3A213%248

Class Bench:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  __construct
number of ops:  4
compiled vars:  !0 = $cli
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      <false>
    8     1        ASSIGN_OBJ                                               'cli'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  add
number of ops:  8
compiled vars:  !0 = $label, !1 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_ARRAY                                       ~4      !0
          3        ADD_ARRAY_ELEMENT                                ~4      !1
          4        FETCH_OBJ_W                                      $2      'functions'
          5        ASSIGN_DIM                                               $2
          6        OP_DATA                                                  ~4
   13     7      > RETURN                                                   null

End of function add

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 8
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 52
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 52
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 38
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 38
Branch analysis from position: 42
Branch analysis from position: 38
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 8
Branch analysis from position: 12
Branch analysis from position: 8
filename:       /in/d9HiW
function name:  run
number of ops:  54
compiled vars:  !0 = $count, !1 = $function, !2 = $stats, !3 = $i, !4 = $stats2, !5 = $timeDiff, !6 = $label
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd9HiW%3A16%240'
          2        ASSIGN                                                   !1, ~7
   18     3        INIT_METHOD_CALL                                         'getStats'
          4        DO_FCALL                                      0  $9      
          5        ASSIGN                                                   !2, $9
   19     6        ASSIGN                                                   !3, !0
          7      > JMP                                                      ->10
          8    >   INIT_DYNAMIC_CALL                                        !1
          9        DO_FCALL                                      0          
         10    >   POST_DEC                                         ~13     !3
         11      > JMPNZ                                                    ~13, ->8
   20    12    >   INIT_METHOD_CALL                                         'getStats'
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !4, $14
   22    15        FETCH_DIM_R                                      ~16     !4, 4
         16        FETCH_DIM_R                                      ~17     !2, 4
         17        SUB                                              ~18     ~16, ~17
         18        ASSIGN                                                   !5, ~18
   24    19        INIT_METHOD_CALL                                         'printStats'
         20        SEND_VAL_EX                                              'Empty+test+%28delta+time+subtracted+from+subsequent+test%29'
         21        SEND_VAR_EX                                              !2
         22        SEND_VAR_EX                                              !4
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0          
   27    25        FETCH_OBJ_R                                      ~21     'functions'
         26      > FE_RESET_R                                       $22     ~21, ->52
         27    > > FE_FETCH_R                                               $22, $23, ->52
         28    >   FETCH_LIST_R                                     $24     $23, 0
         29        ASSIGN                                                   !6, $24
         30        FETCH_LIST_R                                     $26     $23, 1
         31        ASSIGN                                                   !1, $26
         32        FREE                                                     $23
   28    33        INIT_METHOD_CALL                                         'getStats'
         34        DO_FCALL                                      0  $28     
         35        ASSIGN                                                   !2, $28
   30    36        ASSIGN                                                   !3, !0
         37      > JMP                                                      ->40
         38    >   INIT_DYNAMIC_CALL                                        !1
         39        DO_FCALL                                      0          
         40    >   POST_DEC                                         ~32     !3
         41      > JMPNZ                                                    ~32, ->38
   32    42    >   INIT_METHOD_CALL                                         'getStats'
         43        DO_FCALL                                      0  $33     
         44        ASSIGN                                                   !4, $33
   33    45        INIT_METHOD_CALL                                         'printStats'
         46        SEND_VAR_EX                                              !6
         47        SEND_VAR_EX                                              !2
         48        SEND_VAR_EX                                              !4
         49        SEND_VAR_EX                                              !5
         50        DO_FCALL                                      0          
   27    51      > JMP                                                      ->27
         52    >   FE_FREE                                                  $22
   35    53      > RETURN                                                   null

End of function run

Function getstats:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d9HiW
function name:  getStats
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $0      
          2        INIT_ARRAY                                       ~1      $0
          3        INIT_FCALL                                               'memory_get_usage'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $2      
          6        ADD_ARRAY_ELEMENT                                ~1      $2
          7        INIT_FCALL                                               'memory_get_peak_usage'
          8        DO_ICALL                                         $3      
          9        ADD_ARRAY_ELEMENT                                ~1      $3
         10        INIT_FCALL                                               'memory_get_peak_usage'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $4      
         13        ADD_ARRAY_ELEMENT                                ~1      $4
         14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $5      
         17        ADD_ARRAY_ELEMENT                                ~1      $5
         18      > RETURN                                                   ~1
   39    19*     > RETURN                                                   null

End of function getstats

Function printstats:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 154, Position 2 = 163
Branch analysis from position: 154
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 163
Branch analysis from position: 34
filename:       /in/d9HiW
function name:  printStats
number of ops:  164
compiled vars:  !0 = $label, !1 = $stats1, !2 = $stats2, !3 = $timeDiff, !4 = $mem, !5 = $memReal, !6 = $memPeak, !7 = $memRealPeak, !8 = $time, !9 = $memNew, !10 = $memRealNew, !11 = $memPeakNew, !12 = $memRealPeakNew, !13 = $timeNew, !14 = $nl, !15 = $labelLength, !16 = $resultsLength, !17 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   42     4        QM_ASSIGN                                        ~18     !1
          5        FETCH_LIST_R                                     $19     ~18, 0
          6        ASSIGN                                                   !4, $19
          7        FETCH_LIST_R                                     $21     ~18, 1
          8        ASSIGN                                                   !5, $21
          9        FETCH_LIST_R                                     $23     ~18, 2
         10        ASSIGN                                                   !6, $23
         11        FETCH_LIST_R                                     $25     ~18, 3
         12        ASSIGN                                                   !7, $25
         13        FETCH_LIST_R                                     $27     ~18, 4
         14        ASSIGN                                                   !8, $27
         15        FREE                                                     ~18
   43    16        QM_ASSIGN                                        ~29     !2
         17        FETCH_LIST_R                                     $30     ~29, 0
         18        ASSIGN                                                   !9, $30
         19        FETCH_LIST_R                                     $32     ~29, 1
         20        ASSIGN                                                   !10, $32
         21        FETCH_LIST_R                                     $34     ~29, 2
         22        ASSIGN                                                   !11, $34
         23        FETCH_LIST_R                                     $36     ~29, 3
         24        ASSIGN                                                   !12, $36
         25        FETCH_LIST_R                                     $38     ~29, 4
         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.55 ms | 1428 KiB | 23 Q