3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function recurseBenchCallerContex($iterations, $recursionLimit) { if($recursionLimit > 1) { recurseBenchCallerContex($iterations, $recursionLimit - 1); } $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $class = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)['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(10000, 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtIWK
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                                              10000
          5        SEND_VAL_EX                                              1
          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 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 15
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 38
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 38
Branch analysis from position: 43
Branch analysis from position: 38
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 15
Branch analysis from position: 24
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/RtIWK
function name:  recurseBenchCallerContex
number of ops:  48
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                                               1, !1
          3      > JMPZ                                                     ~5, ->9
    8     4    >   INIT_FCALL_BY_NAME                                       '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                                                      ->22
   14    15    >   INIT_FCALL                                               'debug_backtrace'
         16        SEND_VAL                                                 2
         17        SEND_VAL                                                 2
         18        DO_ICALL                                         $11     
         19        FETCH_DIM_R                                      ~12     $11, 'class'
         20        ASSIGN                                                   !4, ~12
   13    21        PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, !0
         23      > JMPNZ                                                    ~15, ->15
   17    24    >   INIT_FCALL                                               'var_dump'
         25        SEND_VAL                                                 'debug_backtrace'
         26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $16     
         29        SUB                                              ~17     $16, !2
         30        SEND_VAL                                                 ~17
         31        DO_ICALL                                                 
   19    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $19     
         35        ASSIGN                                                   !2, $19
   21    36        ASSIGN                                                   !3, 0
         37      > JMP                                                      ->41
   22    38    >   GET_CALLED_CLASS                                 ~22     
         39        ASSIGN                                                   !4, ~22
   21    40        PRE_INC                                                  !3
         41    >   IS_SMALLER                                               !3, !0
         42      > JMPNZ                                                    ~25, ->38
   24    43    >   INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $26     
         46        ASSIGN                                                   !2, $26
   26    47      > RETURN                                                   null

End of function recursebenchcallercontex

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.22 ms | 1400 KiB | 19 Q