3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public function callStatic() { static::doIt(); } public function callNonStatic() { $this->doIt(); } protected static function doIt() { $a = 1; } } $obj = new test(); $time_start = microtime(true); for($i=0;$i<1000000;$i++) { $obj->callStatic(); } $time_end = microtime(true); $time1 = $time_end - $time_start; print "Total execution time is for static call is $time1\n"; $time_start = microtime(true); for($i=0;$i<1000000;$i++) { $obj->callNonStatic(); } $time_end = microtime(true); $time1 = $time_end - $time_start; print "Total execution time is for non static call is $time1\n" ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
Branch analysis from position: 30
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/ecbvS
function name:  (null)
number of ops:  46
compiled vars:  !0 = $obj, !1 = $time_start, !2 = $i, !3 = $time_end, !4 = $time1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $5      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
   23     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !1, $8
   24     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->12
   25     9    >   INIT_METHOD_CALL                                         !0, 'callStatic'
         10        DO_FCALL                                      0          
   24    11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 1000000
         13      > JMPNZ                                                    ~13, ->9
   28    14    >   INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !3, $14
   29    18        SUB                                              ~16     !3, !1
         19        ASSIGN                                                   !4, ~16
   30    20        ROPE_INIT                                     3  ~19     'Total+execution+time+is+for+static+call+is+'
         21        ROPE_ADD                                      1  ~19     ~19, !4
         22        ROPE_END                                      2  ~18     ~19, '%0A'
         23        ECHO                                                     ~18
   32    24        INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $21     
         27        ASSIGN                                                   !1, $21
   33    28        ASSIGN                                                   !2, 0
         29      > JMP                                                      ->33
   34    30    >   INIT_METHOD_CALL                                         !0, 'callNonStatic'
         31        DO_FCALL                                      0          
   33    32        PRE_INC                                                  !2
         33    >   IS_SMALLER                                               !2, 1000000
         34      > JMPNZ                                                    ~26, ->30
   37    35    >   INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $27     
         38        ASSIGN                                                   !3, $27
   38    39        SUB                                              ~29     !3, !1
         40        ASSIGN                                                   !4, ~29
   39    41        ROPE_INIT                                     3  ~32     'Total+execution+time+is+for+non+static+call+is+'
         42        ROPE_ADD                                      1  ~32     ~32, !4
         43        ROPE_END                                      2  ~31     ~32, '%0A'
         44        ECHO                                                     ~31
   41    45      > RETURN                                                   1

Class test:
Function callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ecbvS
function name:  callStatic
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_STATIC_METHOD_CALL                                  'doIt'
          1        DO_FCALL                                      0          
    8     2      > RETURN                                                   null

End of function callstatic

Function callnonstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ecbvS
function name:  callNonStatic
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_METHOD_CALL                                         'doIt'
          1        DO_FCALL                                      0          
   13     2      > RETURN                                                   null

End of function callnonstatic

Function doit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ecbvS
function name:  doIt
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, 1
   18     1      > RETURN                                                   null

End of function doit

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.16 ms | 1405 KiB | 15 Q