3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function recurseBenchCallerContex($iterations, $recursionLimit) { if($recursionLimit > 0) { $this->recurseBenchCallerContex($iterations, $recursionLimit - 1); } $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $class = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['class']; } var_dump('debug_backtrace', microtime(true) - $start); $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $class = get_called_class(); } $start = microtime(true); } } $foo = new Foo; $foo->recurseBenchCallerContex(1, 0);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4SpqB
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   32     3        INIT_METHOD_CALL                                         !0, 'recurseBenchCallerContex'
          4        SEND_VAL_EX                                              1
          5        SEND_VAL_EX                                              0
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class Foo:
Function recursebenchcallercontex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 15
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 39
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 39
Branch analysis from position: 44
Branch analysis from position: 39
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 15
Branch analysis from position: 25
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/4SpqB
function name:  recurseBenchCallerContex
number of ops:  49
compiled vars:  !0 = $iterations, !1 = $recursionLimit, !2 = $start, !3 = $c, !4 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        IS_SMALLER                                               0, !1
          3      > JMPZ                                                     ~5, ->9
    8     4    >   INIT_METHOD_CALL                                         'recurseBenchCallerContex'
          5        SEND_VAR_EX                                              !0
          6        SUB                                              ~6      !1, 1
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0          
   11     9    >   INIT_FCALL                                               'microtime'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !2, $8
   13    13        ASSIGN                                                   !3, 0
         14      > JMP                                                      ->23
   14    15    >   INIT_FCALL                                               'debug_backtrace'
         16        SEND_VAL                                                 2
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $11     
         19        FETCH_DIM_R                                      ~12     $11, 1
         20        FETCH_DIM_R                                      ~13     ~12, 'class'
         21        ASSIGN                                                   !4, ~13
   13    22        PRE_INC                                                  !3
         23    >   IS_SMALLER                                               !3, !0
         24      > JMPNZ                                                    ~16, ->15
   17    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAL                                                 'debug_backtrace'
         27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $17     
         30        SUB                                              ~18     $17, !2
         31        SEND_VAL                                                 ~18
         32        DO_ICALL                                                 
   19    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $20     
         36        ASSIGN                                                   !2, $20
   21    37        ASSIGN                                                   !3, 0
         38      > JMP                                                      ->42
   22    39    >   GET_CALLED_CLASS                                 ~23     
         40        ASSIGN                                                   !4, ~23
   21    41        PRE_INC                                                  !3
         42    >   IS_SMALLER                                               !3, !0
         43      > JMPNZ                                                    ~26, ->39
   24    44    >   INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $27     
         47        ASSIGN                                                   !2, $27
   26    48      > RETURN                                                   null

End of function recursebenchcallercontex

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.79 ms | 1400 KiB | 19 Q