3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Hoa\Bench { class Mark { /** * Mark ID. * * @var \Hoa\Bench\Mark string */ protected $_id = null; /** * Start time. * * @var \Hoa\Bench\Mark float */ protected $start = 0.0; /** * Stop time. * * @var \Hoa\Bench\Mark float */ protected $stop = 0.0; /** * Addition of pause time. * * @var \Hoa\Bench\Mark float */ protected $pause = 0.0; /** * Whether the mark is running. * * @var \Hoa\Bench\Mark bool */ protected $_running = false; /** * Whether the mark is in pause. * * @var \Hoa\Bench\Mark bool */ protected $_pause = false; /** * Built a mark (and set the ID). * * @access public * @param string $id The mark ID. * @return void */ public function __construct ( $id ) { $this->setId($id); return; } /** * Set the mark ID. * * @access protected * @param string $id The mark ID. * @return string */ protected function setId ( $id ) { $old = $this->_id; $this->_id = $id; return $old; } /** * Get the mark ID. * * @access public * @return string */ public function getId ( ) { return $this->_id; } /** * Start the mark. * A mark can be started if it is in pause, stopped, or if it is the first start. * Else, an exception will be thrown. * * @access public * @return \Hoa\Bench\Mark * @throw \Hoa\Bench\Exception */ public function start ( ) { if(true === $this->isRunning()) if(false === $this->isPause()) throw new Exception( 'Cannot start the %s mark, because it is running.', 0, $this->getId()); if(true === $this->isPause()) $this->pause += microtime(true) - $this->stop; else { $this->reset(); $this->start = microtime(true); } $this->_running = true; $this->_pause = false; return $this; } /** * Stop the mark. * A mark can be stopped if it is in pause, or started. Else, an exception * will be thrown (or not, according to the $silent argument). * * @access public * @param bool $silent If set to true and if the mark is not running, * no exception will be thrown. * @return \Hoa\Bench\Mark * @throw \Hoa\Bench\Exception */ public function stop ( $silent = false ) { if(false === $this->isRunning()) if(false === $silent) throw new Exception( 'Cannot stop the %s mark, because it is not running.', 1, $this->getId()); else return $this; $this->stop = microtime(true); $this->_running = false; $this->_pause = false; return $this; } /** * Reset the mark. * * @access public * @return \Hoa\Bench\Mark */ public function reset ( ) { $this->start = 0.0. $this->stop = 0.0; $this->pause = 0.0; $this->_running = false; $this->_pause = false; return $this; } /** * Pause the mark. * A mark can be in pause if it is started. Else, an exception will be * thrown (or not, according to the $silent argument). * * @access public * @param bool $silent If set to true and the mark is not running, * no exception will be throw. Idem if the mark * is in pause. * @return \Hoa\Bench\Mark * @throw \Hoa\Bench\Exception */ public function pause ( $silent = false ) { if(false === $this->isRunning()) if(false === $silent) throw new Exception( 'Cannot stop the %s mark, because it is not running.', 2, $this->getId()); else return $this; if(true === $this->isPause()) if(false === $silent) throw new Exception( 'The %s mark is still in pause. Cannot pause it again.', 3, $this->getId()); else return $this; $this->stop = microtime(true); $this->_pause = true; return $this; } /** * Get the difference between $stop and $start. * If the mark is still running (it contains the pause case), the current * microtime will be used in stay of $stop. * * @access public * @return float */ public function diff ( ) { if(false === $this->isRunning() || true === $this->isPause()) return $this->stop - $this->start - $this->pause; return microtime(true) - $this->start - $this->pause; } /** * Compare to mark. * $a op $b : return -1 if $a < $b, 0 if $a == $b, and 1 if $a > $b. We * compare the difference between $start and $stop, i.e. we call the diff() * method. * * @access public * @param \Hoa\Bench\Mark $mark The mark to compare to. * @return int */ public function compareTo ( Mark $mark ) { $a = $this->diff(); $b = $mark->diff(); if($a < $b) return -1; elseif($a == $b) return 0; else return 1; } /** * Check if the mark is running. * * @access public * @return bool */ public function isRunning ( ) { return $this->_running; } /** * Check if the mark is in pause. * * @access public * @return bool */ public function isPause ( ) { return $this->_pause; } /** * Alias of the diff() method, but return a string, not a float. * * @access public * @return string */ public function __toString ( ) { return (string) $this->diff(); } } class Bench implements \Iterator, \Countable { /** * Statistic : get the result. * * @const int */ const STAT_RESULT = 0; /** * Statistic : get the pourcent. * * @const int */ const STAT_POURCENT = 1; /** * Collection of marks. * * @var \Hoa\Bench array */ protected static $_mark = array(); /** * Collection of filters. * * @var \Hoa\Bench array */ protected $_filters = array(); /** * Get a mark. * If the mark does not exist, it will be automatically create. * * @access public * @param string $id The mark ID. * @return \Hoa\Bench\Mark * @throw \Hoa\Bench\Exception */ public function __get ( $id ) { if(true === $this->markExists($id)) return self::$_mark[$id]; $mark = new Mark($id); self::$_mark[$id] = $mark; return $mark; } /** * Check if a mark exists. * Alias of the protected markExist method. * * @access public * @param string $id The mark ID. * @return bool */ public function __isset ( $id ) { return $this->markExists($id); } /** * Destroy a mark. * * @access public * @param string $id The mark ID. * @return void */ public function __unset ( $id ) { unset(self::$_mark[$id]); return; } /** * Destroy all mark. * * @access public * @return void */ public function unsetAll ( ) { self::$_mark = array(); return; } /** * Check if a mark already exists. * * @access protected * @param string $id The mark ID. * @return bool */ protected function markExists ( $id ) { return isset(self::$_mark[$id]); } /** * Get the current mark for the iterator. * * @access public * @return \Hoa\Bench\Mark */ public function current ( ) { return current(self::$_mark); } /** * Get the current mark ID for the iterator. * * @access public * @return string */ public function key ( ) { return key(self::$_mark); } /** * Advance the internal mark collection pointer, and return the current * mark. * * @access public * @return \Hoa\Bench\Mark */ public function next ( ) { return next(self::$_mark); } /** * Rewind the internal mark collection pointer, and return the first mark. * * @access public * @return \Hoa\Bench\Mark */ public function rewind ( ) { return reset(self::$_mark); } /** * Check if there is a current element after calls the rewind or the next * methods. * * @access public * @return bool */ public function valid ( ) { if(empty(self::$_mark)) return false; $key = key(self::$_mark); $return = (next(self::$_mark) ? true : false); prev(self::$_mark); if(false === $return) { end(self::$_mark); if($key === key(self::$_mark)) $return = true; } return $return; } /** * Add a filter. * Used in the self::getStatistic() method, no in iterator. * A filter is a callable that will receive 3 values about a mark: ID, time * result, and time pourcent. The callable must return a boolean. * * @access public * @param mixed $callable Callable. * @return void */ public function filter ( $callable ) { $this->_filters[] = xcallable($callable); return $this; } /** * Return all filters. * * @access public * @return array */ public function getFilters ( ) { return $this->_filters; } /** * Get statistic. * Return an associative array : id => sub-array. The sub-array contains the * result time in second (given by the constant self::STAT_RESULT), and the * result pourcent (given by the constant self::START_POURCENT). * * @access public * @param bool $considerFilters Whether we should consider filters or * not. * @return array */ public function getStatistic ( $considerFilters = true ) { if(empty(self::$_mark)) return array(); $max = $this->getLongest()->diff(); $out = array(); foreach($this as $id => $mark) { $result = $mark->diff(); $pourcent = ($result * 100) / $max; if(true === $considerFilters) foreach($this->getFilters() as $filter) if(true !== $filter($id, $result, $pourcent)) continue 2; $out[$id] = array( self::STAT_RESULT => $result, self::STAT_POURCENT => $pourcent ); } return $out; } /** * Get the maximum, i.e. the longest mark in time. * * @access public * @return \Hoa\Bench\Mark */ public function getLongest ( ) { $max = 0; $outMark = null; foreach($this as $id => $mark) if($mark->diff() > $max) { $outMark = $mark; $max = $mark->diff(); } return $outMark; } /** * Draw statistic in text mode. * * @access public * @param int $width The graphic width. * @return string * @throw \Hoa\Bench\Exception */ public function drawStatistic ( $width = 80 ) { if(empty(self::$_mark)) return ''; if($width < 1) throw new Exception( 'The graphic width must be positive, given %d.', 0, $width); $out = null; $stats = $this->getStatistic(); $margin = 0; foreach($stats as $id => $foo) strlen($id) > $margin and $margin = strlen($id); $width = $width - $margin - 18; $format = '%-' . $margin . 's %-' . $width . 's %5dms, %5.1f%%' . "\n"; foreach($stats as $id => $stat) $out .= sprintf( $format, $id, str_repeat( '|', round(($stat[self::STAT_POURCENT] * $width) / 100) ), round(1000 * $stat[self::STAT_RESULT]), round($stat[self::STAT_POURCENT], 3) ); return $out; } /** * Count the number of mark. * * @access public * @return int */ public function count ( ) { return count(self::$_mark); } /** * Alias of drawStatistic() method. * * @access public * @return string */ public function __toString ( ) { return $this->drawStatistic(); } } } namespace { mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); $bench = new Hoa\Bench\Bench(); $memory = array(); $string = null; $tokens = array('foo', 'bar', 'baz', 'qux', 'gordon', 'freeman'); $_ = count($tokens) - 1; for($i = 0; $i < 1000; ++$i) $string .= $tokens[mt_rand(0, $_)]; $_string = $string; $memory['substr'] = memory_get_usage(); $bench->substr->start(); while(0 < strlen($_string)) { foreach($tokens as $token) { if(0 === preg_match('#^(?:' . $token . ')#u', $_string, $matches)) continue; $_string = mb_substr($_string, mb_strlen($matches[0])); break; } } $bench->substr->stop(); $memory['substr'] = memory_get_usage() - $memory['substr']; unset($matches); unset($_string); $_string = $string; $offset = 0; $maxoffset = mb_strlen($_string); $memory['offset'] = memory_get_usage(); $bench->offset->start(); while($offset < $maxoffset) { foreach($tokens as $token) { if(0 === preg_match('#(?:' . $token . ')#u', $_string, $matches, PREG_OFFSET_CAPTURE, $offset)) continue; if($offset !== $matches[0][1]) continue; $offset += mb_strlen($matches[0][0]); break; } } $bench->offset->stop(); $memory['offset'] = memory_get_usage() - $memory['offset']; echo $bench; print_r($memory); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 37
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 117
Branch analysis from position: 117
2 jumps found. (Code = 44) Position 1 = 119, Position 2 = 89
Branch analysis from position: 119
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 89
2 jumps found. (Code = 77) Position 1 = 90, Position 2 = 116
Branch analysis from position: 90
2 jumps found. (Code = 78) Position 1 = 91, Position 2 = 116
Branch analysis from position: 91
2 jumps found. (Code = 43) Position 1 = 102, Position 2 = 103
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 90
Branch analysis from position: 90
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 108
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 90
Branch analysis from position: 90
Branch analysis from position: 108
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
2 jumps found. (Code = 44) Position 1 = 119, Position 2 = 89
Branch analysis from position: 119
Branch analysis from position: 89
Branch analysis from position: 116
Branch analysis from position: 116
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 60
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 60
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 49
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 37
Branch analysis from position: 64
Branch analysis from position: 37
Branch analysis from position: 60
Branch analysis from position: 60
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 19
Branch analysis from position: 28
Branch analysis from position: 19
filename:       /in/1DGqO
function name:  (null)
number of ops:  133
compiled vars:  !0 = $bench, !1 = $memory, !2 = $string, !3 = $tokens, !4 = $_, !5 = $i, !6 = $_string, !7 = $token, !8 = $matches, !9 = $offset, !10 = $maxoffset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'hoa%5Cbench%5Cmark'
  278     1        DECLARE_CLASS                                            'hoa%5Cbench%5Cbench'
  608     2        INIT_FCALL                                               'mb_internal_encoding'
          3        SEND_VAL                                                 'UTF-8'
          4        DO_ICALL                                                 
  609     5        INIT_FCALL                                               'mb_regex_encoding'
          6        SEND_VAL                                                 'UTF-8'
          7        DO_ICALL                                                 
  611     8        NEW                                              $13     'Hoa%5CBench%5CBench'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $13
  612    11        ASSIGN                                                   !1, <array>
  613    12        ASSIGN                                                   !2, null
  614    13        ASSIGN                                                   !3, <array>
  615    14        COUNT                                            ~19     !3
         15        SUB                                              ~20     ~19, 1
         16        ASSIGN                                                   !4, ~20
  617    17        ASSIGN                                                   !5, 0
         18      > JMP                                                      ->26
  618    19    >   INIT_FCALL                                               'mt_rand'
         20        SEND_VAL                                                 0
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                         $23     
         23        FETCH_DIM_R                                      ~24     !3, $23
         24        ASSIGN_OP                                     8          !2, ~24
  617    25        PRE_INC                                                  !5
         26    >   IS_SMALLER                                               !5, 1000
         27      > JMPNZ                                                    ~27, ->19
  621    28    >   ASSIGN                                                   !6, !2
  622    29        INIT_FCALL                                               'memory_get_usage'
         30        DO_ICALL                                         $30     
         31        ASSIGN_DIM                                               !1, 'substr'
         32        OP_DATA                                                  $30
  623    33        FETCH_OBJ_R                                      ~31     !0, 'substr'
         34        INIT_METHOD_CALL                                         ~31, 'start'
         35        DO_FCALL                                      0          
  625    36      > JMP                                                      ->61
  627    37    > > FE_RESET_R                                       $33     !3, ->60
         38    > > FE_FETCH_R                                               $33, !7, ->60
  629    39    >   INIT_FCALL                                               'preg_match'
         40        CONCAT                                           ~34     '%23%5E%28%3F%3A', !7
         41        CONCAT                                           ~35     ~34, '%29%23u'
         42        SEND_VAL                                                 ~35
         43        SEND_VAR                                                 !6
         44        SEND_REF                                                 !8
         45        DO_ICALL                                         $36     
         46        IS_IDENTICAL                                             $36, 0
         47      > JMPZ                                                     ~37, ->49
  630    48    > > JMP                                                      ->38
  632    49    >   INIT_FCALL                                               'mb_substr'
         50        SEND_VAR                                                 !6
         51        INIT_FCALL                                               'mb_strlen'
         52        FETCH_DIM_R                                      ~38     !8, 0
         53        SEND_VAL                                                 ~38
         54        DO_ICALL                                         $39     
         55        SEND_VAR                                                 $39
         56        DO_ICALL                                         $40     
         57        ASSIGN                                                   !6, $40
  633    58      > JMP                                                      ->60
  627    59*       JMP                                                      ->38
         60    >   FE_FREE                                                  $33
  625    61    >   STRLEN                                           ~42     !6
         62        IS_SMALLER                                               0, ~42
         63      > JMPNZ                                                    ~43, ->37
  637    64    >   FETCH_OBJ_R                                      ~44     !0, 'substr'
         65        INIT_METHOD_CALL                                         ~44, 'stop'
         66        DO_FCALL                                      0          
  638    67        INIT_FCALL                                               'memory_get_usage'
         68        DO_ICALL                                         $47     
         69        FETCH_DIM_R                                      ~48     !1, 'substr'
         70        SUB                                              ~49     $47, ~48
         71        ASSIGN_DIM                                               !1, 'substr'
         72        OP_DATA                                                  ~49
  640    73        UNSET_CV                                                 !8
  641    74        UNSET_CV                                                 !6
  643    75        ASSIGN                                                   !6, !2
  644    76        ASSIGN                                                   !9, 0
  645    77        INIT_FCALL                                               'mb_strlen'
         78        SEND_VAR                                                 !6
         79        DO_ICALL                                         $52     
         80        ASSIGN                                                   !10, $52
  646    81        INIT_FCALL                                               'memory_get_usage'
         82        DO_ICALL                                         $55     
         83        ASSIGN_DIM                                               !1, 'offset'
         84        OP_DATA                                                  $55
  647    85        FETCH_OBJ_R                                      ~56     !0, 'offset'
         86        INIT_METHOD_CALL                                         ~56, 'start'
         87        DO_FCALL                                      0          
  649    88      > JMP                                                      ->117
  651    89    > > FE_RESET_R                                       $58     !3, ->116
         90    > > FE_FETCH_R                                               $58, !7, ->116
  653    91    >   INIT_FCALL                                               'preg_match'
         92        CONCAT                                           ~59     '%23%28%3F%3A', !7
         93        CONCAT                                           ~60     ~59, '%29%23u'
         94        SEND_VAL                                                 ~60
         95        SEND_VAR                                                 !6
         96        SEND_REF                                                 !8
         97        SEND_VAL                                                 256
         98        SEND_VAR                                                 !9
         99        DO_ICALL                                         $61     
        100        IS_IDENTICAL                                             $61, 0
        101      > JMPZ                                                     ~62, ->103
  654   102    > > JMP                                                      ->90
  656   103    >   FETCH_DIM_R                                      ~63     !8, 0
        104        FETCH_DIM_R                                      ~64     ~63, 1
        105        IS_NOT_IDENTICAL                                         !9, ~64
        106      > JMPZ                                                     ~65, ->108
  657   107    > > JMP                                                      ->90
  659   108    >   INIT_FCALL                                               'mb_strlen'
        109        FETCH_DIM_R                                      ~66     !8, 0
        110        FETCH_DIM_R                                      ~67     ~66, 0
        111        SEND_VAL                                                 ~67
        112        DO_ICALL                                         $68     
        113        ASSIGN_OP                                     1          !9, $68
  660   114      > JMP                                                      ->116
  651   115*       JMP                                                      ->90
        116    >   FE_FREE                                                  $58
  649   117    >   IS_SMALLER                                               !9, !10
        118      > JMPNZ                                                    ~70, ->89
  664   119    >   FETCH_OBJ_R                                      ~71     !0, 'offset'
        120        INIT_METHOD_CALL                                         ~71, 'stop'
        121        DO_FCALL                                      0          
  665   122        INIT_FCALL                                               'memory_get_usage'
        123        DO_ICALL                                         $74     
        124        FETCH_DIM_R                                      ~75     !1, 'offset'
        125        SUB                                              ~76     $74, ~75
        126        ASSIGN_DIM                                               !1, 'offset'
        127        OP_DATA                                                  ~76
  668   128        ECHO                                                     !0
  669   129        INIT_FCALL                                               'print_r'
        130        SEND_VAR                                                 !1
        131        DO_ICALL                                                 
  671   132      > RETURN                                                   1

Class Hoa\Bench\Mark:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  __construct
number of ops:  6
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   RECV                                             !0      
   60     1        INIT_METHOD_CALL                                         'setId'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   62     4      > RETURN                                                   null
   63     5*     > RETURN                                                   null

End of function __construct

Function setid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  setId
number of ops:  7
compiled vars:  !0 = $id, !1 = $old
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     0  E >   RECV                                             !0      
   74     1        FETCH_OBJ_R                                      ~2      '_id'
          2        ASSIGN                                                   !1, ~2
   75     3        ASSIGN_OBJ                                               '_id'
          4        OP_DATA                                                  !0
   77     5      > RETURN                                                   !1
   78     6*     > RETURN                                                   null

End of function setid

Function getid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  getId
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   88     0  E >   FETCH_OBJ_R                                      ~0      '_id'
          1      > RETURN                                                   ~0
   89     2*     > RETURN                                                   null

End of function getid

Function start:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/1DGqO
function name:  start
number of ops:  42
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  102     0  E >   INIT_METHOD_CALL                                         'isRunning'
          1        DO_FCALL                                      0  $0      
          2        TYPE_CHECK                                    8          $0
          3      > JMPZ                                                     ~1, ->16
  103     4    >   INIT_METHOD_CALL                                         'isPause'
          5        DO_FCALL                                      0  $2      
          6        TYPE_CHECK                                    4          $2
          7      > JMPZ                                                     ~3, ->16
  104     8    >   NEW                                              $4      'Hoa%5CBench%5CException'
  105     9        SEND_VAL_EX                                              'Cannot+start+the+%25s+mark%2C+because+it+is+running.'
  106    10        SEND_VAL_EX                                              0
         11        INIT_METHOD_CALL                                         'getId'
         12        DO_FCALL                                      0  $5      
         13        SEND_VAR_NO_REF_EX                                       $5
         14        DO_FCALL                                      0          
         15      > THROW                                         0          $4
  108    16    >   INIT_METHOD_CALL                                         'isPause'
         17        DO_FCALL                                      0  $7      
         18        TYPE_CHECK                                    8          $7
         19      > JMPZ                                                     ~8, ->28
  109    20    >   INIT_NS_FCALL_BY_NAME                                    'Hoa%5CBench%5Cmicrotime'
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0  $10     
         23        FETCH_OBJ_R                                      ~11     'stop'
         24        SUB                                              ~12     $10, ~11
         25        ASSIGN_OBJ_OP                                 1          'pause'
         26        OP_DATA                                                  ~12
         27      > JMP                                                      ->35
  112    28    >   INIT_METHOD_CALL                                         'reset'
         29        DO_FCALL                                      0          
  113    30        INIT_NS_FCALL_BY_NAME                                    'Hoa%5CBench%5Cmicrotime'
         31        SEND_VAL_EX                                              <true>
         32        DO_FCALL                                      0  $15     
         33        ASSIGN_OBJ                                               'start'
         34        OP_DATA                                                  $15
  116    35    >   ASSIGN_OBJ                                               '_running'
         36        OP_DATA                                                  <true>
  117    37        ASSIGN_OBJ                                               '_pause'
         38        OP_DATA                                                  <false>
  119    39        FETCH_THIS                                       ~18     
         40      > RETURN                                                   ~18
  120    41*     > RETURN                                                   null

End of function start

Function stop:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  stop
number of ops:  30
compiled vars:  !0 = $silent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  133     0  E >   RECV_INIT                                        !0      <false>
  135     1        INIT_METHOD_CALL                                         'isRunning'
          2        DO_FCALL                                      0  $1      
          3        TYPE_CHECK                                    4          $1
          4      > JMPZ                                                     ~2, ->18
  136     5    >   TYPE_CHECK                                    4          !0
          6      > JMPZ                                                     ~3, ->16
  137     7    >   NEW                                              $4      'Hoa%5CBench%5CException'
  138     8        SEND_VAL_EX                                              'Cannot+stop+the+%25s+mark%2C+because+it+is+not+running.'
  139     9        SEND_VAL_EX                                              1
         10        INIT_METHOD_CALL                                         'getId'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR_NO_REF_EX                                       $5
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $4
         15*       JMP                                                      ->18
  141    16    >   FETCH_THIS                                       ~7      
         17      > RETURN                                                   ~7
  143    18    >   INIT_NS_FCALL_BY_NAME                                    'Hoa%5CBench%5Cmicrotime'
         19        SEND_VAL_EX                                              <true>
         20        DO_FCALL                                      0  $9      
         21        ASSIGN_OBJ                                               'stop'
         22        OP_DATA                                                  $9
  144    23        ASSIGN_OBJ                                               '_running'
         24        OP_DATA                                                  <false>
  145    25        ASSIGN_OBJ                                               '_pause'
         26        OP_DATA                                                  <false>
  147    27        FETCH_THIS                                       ~12     
         28      > RETURN                                                   ~12
  148    29*     > RETURN                                                   null

End of function stop

Function reset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  reset
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  159     0  E >   ASSIGN_OBJ                                       ~1      'stop'
          1        OP_DATA                                                  0
          2        CONCAT                                           ~2      '0', ~1
  158     3        ASSIGN_OBJ                                               'start'
  159     4        OP_DATA                                                  ~2
  160     5        ASSIGN_OBJ                                               'pause'
          6        OP_DATA                                                  0
  161     7        ASSIGN_OBJ                                               '_running'
          8        OP_DATA                                                  <false>
  162     9        ASSIGN_OBJ                                               '_pause'
         10        OP_DATA                                                  <false>
  164    11        FETCH_THIS                                       ~6      
         12      > RETURN                                                   ~6
  165    13*     > RETURN                                                   null

End of function reset

Function pause:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 35
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 33
Branch analysis from position: 24
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1DGqO
function name:  pause
number of ops:  45
compiled vars:  !0 = $silent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  179     0  E >   RECV_INIT                                        !0      <false>
  181     1        INIT_METHOD_CALL                                         'isRunning'
          2        DO_FCALL                                      0  $1      
          3        TYPE_CHECK                                    4          $1
          4      > JMPZ                                                     ~2, ->18
  182     5    >   TYPE_CHECK                                    4          !0
          6      > JMPZ                                                     ~3, ->16
  183     7    >   NEW                                              $4      'Hoa%5CBench%5CException'
  184     8        SEND_VAL_EX                                              'Cannot+stop+the+%25s+mark%2C+because+it+is+not+running.'
  185     9        SEND_VAL_EX                                              2
         10        INIT_METHOD_CALL                                         'getId'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR_NO_REF_EX                                       $5
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $4
         15*       JMP                                                      ->18
  187    16    >   FETCH_THIS                                       ~7      
         17      > RETURN                                                   ~7
  189    18    >   INIT_METHOD_CALL                                         'isPause'
         19        DO_FCALL                                      0  $8      
         20        TYPE_CHECK                                    8          $8
         21      > JMPZ                                                     ~9, ->35
  190    22    >   TYPE_CHECK                                    4          !0
         23      > JMPZ                                                     ~10, ->33
  191    24    >   NEW                                              $11     'Hoa%5CBench%5CException'
  192    25        SEND_VAL_EX                                              'The+%25s+mark+is+still+in+pause.+Cannot+pause+it+again.'
  193    26        SEND_VAL_EX                                              3
         27        INIT_METHOD_CALL                                         'getId'
         28        DO_FCALL                                      0  $12     
         29        SEND_VAR_NO_REF_EX                                       $12
         30        DO_FCALL                                      0          
         31      > THROW                                         0          $11
         32*       JMP                                                      ->35
  195    33    >   FETCH_THIS                                       ~14     
         34      > RETURN                                                   ~14
  197    35    >   INIT_NS_FCALL_BY_NAME                                    'Hoa%5CBench%5Cmicrotime'
         36        SEND_VAL_EX                                              <true>
         37        DO_FCALL                                      0  $16     
         38        ASSIGN_OBJ                                               'stop'
         39        OP_DATA                                                  $16
  198    40        ASSIGN_OBJ                                               '_pause'
         41        OP_DATA                                                  <true>
  200    42        FETCH_THIS                                       ~18     
         43      > RETURN                                                   ~18
  201    44*     > RETURN                                                   null

End of function pause

Function diff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/1DGqO
function name:  diff
number of ops:  24
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  213     0  E >   INIT_METHOD_CALL                                         'isRunning'
          1        DO_FCALL                                      0  $0      
          2        TYPE_CHECK                                    4  ~1      $0
          3      > JMPNZ_EX                                         ~1      ~1, ->8
          4    >   INIT_METHOD_CALL                                         'isPause'
          5        DO_FCALL                                      0  $2      
          6        TYPE_CHECK                                    8  ~3      $2
          7        BOOL                                             ~1      ~3
          8    > > JMPZ                                                     ~1, ->15
  214     9    >   FETCH_OBJ_R                                      ~4      'stop'
         10        FETCH_OBJ_R                                      ~5      'start'
         11        SUB                                              ~6      ~4, ~5
         12        FETCH_OBJ_R                                      ~7      'pause'
         13        SUB                                              ~8      ~6, ~7
         14      > RETURN                                                   ~8
  216    15    >   INIT_NS_FCALL_BY_NAME                                    'Hoa%5CBench%5Cmicrotime'
         16        SEND_VAL_EX                                              <true>
         17        DO_FCALL                                      0  $9      
         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.71 ms | 1420 KiB | 31 Q