3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('LOOP',1000000); class ClassA { static function a() { } } function b() { } function f1() { for($i=0; $i<LOOP; ++$i) { ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); ClassA::a(); } } function f2() { for($i=0; $i<LOOP; ++$i) { b(); b(); b(); b(); b(); b(); b(); b(); b(); b(); } } $start = microtime(true); f1(); $stop = microtime(true); $time1 = $stop - $start; $start = microtime(true); f2(); $stop = microtime(true); $time2 = $stop - $start; echo $time1 . "\t"; echo $time2 . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHptL
function name:  (null)
number of ops:  33
compiled vars:  !0 = $start, !1 = $stop, !2 = $time1, !3 = $time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'LOOP'
          2        SEND_VAL                                                 1000000
          3        DO_ICALL                                                 
   43     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !0, $5
   44     8        INIT_FCALL                                               'f1'
          9        DO_FCALL                                      0          
   45    10        INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !1, $8
   46    14        SUB                                              ~10     !1, !0
         15        ASSIGN                                                   !2, ~10
   48    16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $12     
         19        ASSIGN                                                   !0, $12
   49    20        INIT_FCALL                                               'f2'
         21        DO_FCALL                                      0          
   50    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $15     
         25        ASSIGN                                                   !1, $15
   51    26        SUB                                              ~17     !1, !0
         27        ASSIGN                                                   !3, ~17
   53    28        CONCAT                                           ~19     !2, '%09'
         29        ECHO                                                     ~19
   54    30        CONCAT                                           ~20     !3, '%0A'
         31        ECHO                                                     ~20
         32      > RETURN                                                   1

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHptL
function name:  b
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   null

End of function b

Function f1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
Branch analysis from position: 2
filename:       /in/MHptL
function name:  f1
number of ops:  27
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->23
   15     2    >   INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
          3        DO_FCALL                                      0          
   16     4        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
          5        DO_FCALL                                      0          
   17     6        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
          7        DO_FCALL                                      0          
   18     8        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
          9        DO_FCALL                                      0          
   19    10        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         11        DO_FCALL                                      0          
   20    12        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         13        DO_FCALL                                      0          
   21    14        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         15        DO_FCALL                                      0          
   22    16        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         17        DO_FCALL                                      0          
   23    18        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         19        DO_FCALL                                      0          
   24    20        INIT_STATIC_METHOD_CALL                                  'ClassA', 'a'
         21        DO_FCALL                                      0          
   14    22        PRE_INC                                                  !0
         23    >   FETCH_CONSTANT                                   ~13     'LOOP'
         24        IS_SMALLER                                               !0, ~13
         25      > JMPNZ                                                    ~14, ->2
   26    26    > > RETURN                                                   null

End of function f1

Function f2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 2
Branch analysis from position: 26
Branch analysis from position: 2
filename:       /in/MHptL
function name:  f2
number of ops:  27
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->23
   30     2    >   INIT_FCALL                                               'b'
          3        DO_FCALL                                      0          
   31     4        INIT_FCALL                                               'b'
          5        DO_FCALL                                      0          
   32     6        INIT_FCALL                                               'b'
          7        DO_FCALL                                      0          
   33     8        INIT_FCALL                                               'b'
          9        DO_FCALL                                      0          
   34    10        INIT_FCALL                                               'b'
         11        DO_FCALL                                      0          
   35    12        INIT_FCALL                                               'b'
         13        DO_FCALL                                      0          
   36    14        INIT_FCALL                                               'b'
         15        DO_FCALL                                      0          
   37    16        INIT_FCALL                                               'b'
         17        DO_FCALL                                      0          
   38    18        INIT_FCALL                                               'b'
         19        DO_FCALL                                      0          
   39    20        INIT_FCALL                                               'b'
         21        DO_FCALL                                      0          
   29    22        PRE_INC                                                  !0
         23    >   FETCH_CONSTANT                                   ~13     'LOOP'
         24        IS_SMALLER                                               !0, ~13
         25      > JMPNZ                                                    ~14, ->2
   41    26    > > RETURN                                                   null

End of function f2

Class ClassA:
Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHptL
function name:  a
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   null

End of function a

End of class ClassA.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.12 ms | 1407 KiB | 29 Q