3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeObj { public function doTest() {} } $someObj = new SomeObj; class SomeClass { public static function doTest() {;} } function something_doTest() {} // bench static method $starttime = microtime(true); for ($i = 0; $i< 10*1000*1000; $i++) SomeClass::doTest($i); echo "Static Time: " , (microtime(true)-$starttime) , " ms\n"; // bench object method $starttime = microtime(true); for ($i = 0; $i< 10*1000*1000; $i++) $someObj->doTest($i); echo "Object Time: " , (microtime(true)-$starttime) , " ms\n"; // bench function $starttime = microtime(true); for ($i = 0; $i< 10*1000*1000; $i++) something_doTest($i); echo "Function Time: " , (microtime(true)-$starttime) , " ms\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 9
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 47
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 47
Branch analysis from position: 53
Branch analysis from position: 47
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 28
Branch analysis from position: 34
Branch analysis from position: 28
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 9
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/6aiug
function name:  (null)
number of ops:  61
compiled vars:  !0 = $someObj, !1 = $starttime, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $3      'SomeObj'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   19     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !1, $6
   20     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->13
   21     9    >   INIT_STATIC_METHOD_CALL                                  'SomeClass', 'doTest'
         10        SEND_VAR                                                 !2
         11        DO_FCALL                                      0          
   20    12        PRE_INC                                                  !2
         13    >   IS_SMALLER                                               !2, 10000000
         14      > JMPNZ                                                    ~11, ->9
   23    15    >   ECHO                                                     'Static+Time%3A+++'
         16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $12     
         19        SUB                                              ~13     $12, !1
         20        ECHO                                                     ~13
         21        ECHO                                                     '+ms%0A'
   26    22        INIT_FCALL                                               'microtime'
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $14     
         25        ASSIGN                                                   !1, $14
   28    26        ASSIGN                                                   !2, 0
         27      > JMP                                                      ->32
   29    28    >   INIT_METHOD_CALL                                         !0, 'doTest'
         29        SEND_VAR_EX                                              !2
         30        DO_FCALL                                      0          
   28    31        PRE_INC                                                  !2
         32    >   IS_SMALLER                                               !2, 10000000
         33      > JMPNZ                                                    ~19, ->28
   31    34    >   ECHO                                                     'Object+Time%3A+++'
         35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $20     
         38        SUB                                              ~21     $20, !1
         39        ECHO                                                     ~21
         40        ECHO                                                     '+ms%0A'
   34    41        INIT_FCALL                                               'microtime'
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $22     
         44        ASSIGN                                                   !1, $22
   36    45        ASSIGN                                                   !2, 0
         46      > JMP                                                      ->51
   37    47    >   INIT_FCALL                                               'something_dotest'
         48        SEND_VAR                                                 !2
         49        DO_FCALL                                      0          
   36    50        PRE_INC                                                  !2
         51    >   IS_SMALLER                                               !2, 10000000
         52      > JMPNZ                                                    ~27, ->47
   39    53    >   ECHO                                                     'Function+Time%3A+'
         54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $28     
         57        SUB                                              ~29     $28, !1
         58        ECHO                                                     ~29
         59        ECHO                                                     '+ms%0A'
         60      > RETURN                                                   1

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

End of function something_dotest

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

End of function dotest

End of class SomeObj.

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

End of function dotest

End of class SomeClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.73 ms | 1407 KiB | 16 Q