3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function foo($a, $b) {} } function row($name, $t) { printf("%-40s %8s x 10 µs\n", $name, number_format((microtime(true)-$t)*1e5, 2)); } $max = 5*1e1; $object = new A; $t = microtime (true); for ($i=0; $i<$max; $i++) { $object->foo(1, 'foo'); } row($max.' x A::foo', $t); $t = microtime (true); for ($i=0; $i<$max; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } row($max.' x call_user_func_array', $t); $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } row($max.' x ReflectionMethod::invokeArgs', $t); $t = microtime (true); for ($j=0; $j<$max/10; $j++) { $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<10; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } } row(($max/10).' x (10 x ReflectionMethod::invokeArgs)', $t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 28
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 53
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 86
Branch analysis from position: 86
2 jumps found. (Code = 44) Position 1 = 89, Position 2 = 71
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 78
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 89, Position 2 = 71
Branch analysis from position: 89
Branch analysis from position: 71
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 78
Branch analysis from position: 85
Branch analysis from position: 78
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 53
Branch analysis from position: 60
Branch analysis from position: 53
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 28
Branch analysis from position: 37
Branch analysis from position: 28
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 10
Branch analysis from position: 17
Branch analysis from position: 10
filename:       /in/OjtA7
function name:  (null)
number of ops:  96
compiled vars:  !0 = $max, !1 = $object, !2 = $t, !3 = $i, !4 = $ref, !5 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 50
   11     1        NEW                                              $7      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   13     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !2, $10
   14     8        ASSIGN                                                   !3, 0
          9      > JMP                                                      ->15
   15    10    >   INIT_METHOD_CALL                                         !1, 'foo'
         11        SEND_VAL_EX                                              1
         12        SEND_VAL_EX                                              'foo'
         13        DO_FCALL                                      0          
   14    14        PRE_INC                                                  !3
         15    >   IS_SMALLER                                               !3, !0
         16      > JMPNZ                                                    ~15, ->10
   17    17    >   INIT_FCALL                                               'row'
         18        CONCAT                                           ~16     !0, '+x+A%3A%3Afoo'
         19        SEND_VAL                                                 ~16
         20        SEND_VAR                                                 !2
         21        DO_FCALL                                      0          
   19    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $18     
         25        ASSIGN                                                   !2, $18
   20    26        ASSIGN                                                   !3, 0
         27      > JMP                                                      ->35
   21    28    >   INIT_ARRAY                                       ~21     !1
         29        ADD_ARRAY_ELEMENT                                ~21     'foo'
         30        INIT_USER_CALL                                0          'call_user_func_array', ~21
         31        SEND_ARRAY                                               <array>
         32        CHECK_UNDEF_ARGS                                         
         33        DO_FCALL                                      0          
   20    34        PRE_INC                                                  !3
         35    >   IS_SMALLER                                               !3, !0
         36      > JMPNZ                                                    ~24, ->28
   23    37    >   INIT_FCALL                                               'row'
         38        CONCAT                                           ~25     !0, '+x+call_user_func_array'
         39        SEND_VAL                                                 ~25
         40        SEND_VAR                                                 !2
         41        DO_FCALL                                      0          
   25    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $27     
         45        ASSIGN                                                   !2, $27
   26    46        NEW                                              $29     'ReflectionMethod'
         47        SEND_VAR_EX                                              !1
         48        SEND_VAL_EX                                              'foo'
         49        DO_FCALL                                      0          
         50        ASSIGN                                                   !4, $29
   27    51        ASSIGN                                                   !3, 0
         52      > JMP                                                      ->58
   28    53    >   INIT_METHOD_CALL                                         !4, 'invokeArgs'
         54        SEND_VAR_EX                                              !1
         55        SEND_VAL_EX                                              <array>
         56        DO_FCALL                                      0          
   27    57        PRE_INC                                                  !3
         58    >   IS_SMALLER                                               !3, !0
         59      > JMPNZ                                                    ~35, ->53
   30    60    >   INIT_FCALL                                               'row'
         61        CONCAT                                           ~36     !0, '+x+ReflectionMethod%3A%3AinvokeArgs'
         62        SEND_VAL                                                 ~36
         63        SEND_VAR                                                 !2
         64        DO_FCALL                                      0          
   32    65        INIT_FCALL                                               'microtime'
         66        SEND_VAL                                                 <true>
         67        DO_ICALL                                         $38     
         68        ASSIGN                                                   !2, $38
   33    69        ASSIGN                                                   !5, 0
         70      > JMP                                                      ->86
   34    71    >   NEW                                              $41     'ReflectionMethod'
         72        SEND_VAR_EX                                              !1
         73        SEND_VAL_EX                                              'foo'
         74        DO_FCALL                                      0          
         75        ASSIGN                                                   !4, $41
   35    76        ASSIGN                                                   !3, 0
         77      > JMP                                                      ->83
   36    78    >   INIT_METHOD_CALL                                         !4, 'invokeArgs'
         79        SEND_VAR_EX                                              !1
         80        SEND_VAL_EX                                              <array>
         81        DO_FCALL                                      0          
   35    82        PRE_INC                                                  !3
         83    >   IS_SMALLER                                               !3, 10
         84      > JMPNZ                                                    ~47, ->78
   33    85    >   PRE_INC                                                  !5
         86    >   DIV                                              ~49     !0, 10
         87        IS_SMALLER                                               !5, ~49
         88      > JMPNZ                                                    ~50, ->71
   39    89    >   INIT_FCALL                                               'row'
         90        DIV                                              ~51     !0, 10
         91        CONCAT                                           ~52     ~51, '+x+%2810+x+ReflectionMethod%3A%3AinvokeArgs%29'
         92        SEND_VAL                                                 ~52
         93        SEND_VAR                                                 !2
         94        DO_FCALL                                      0          
         95      > RETURN                                                   1

Function row:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OjtA7
function name:  row
number of ops:  17
compiled vars:  !0 = $name, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 '%25-40s+%258s+x+10+%C2%B5s%0A'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'number_format'
          6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $2      
          9        SUB                                              ~3      $2, !1
         10        MUL                                              ~4      ~3, 100000
         11        SEND_VAL                                                 ~4
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $5      
         14        SEND_VAR                                                 $5
         15        DO_ICALL                                                 
    8    16      > RETURN                                                   null

End of function row

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OjtA7
function name:  foo
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.75 ms | 1402 KiB | 23 Q