3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ABD\dsgsdgf\sd; if(PHP_VERSION_ID < 50400) { return; } class Foo { function recurseBenchCallerContex($iterations, $recursionLimit) { if($recursionLimit > 0) { return $this->recurseBenchCallerContex($iterations, $recursionLimit - 1); } $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4); $class = isset($trace[1]['class']) ? $trace[1]['class'] : null; } var_dump('debug_backtrace', $trace, microtime(true) - $start); $start = microtime(true); for($c = 0; $c < $iterations; $c++) { $class = get_called_class(); } var_dump('debug_backtrace full', microtime(true) - $start); } } $foo = new Foo; $foo->recurseBenchCallerContex(10000, 100);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DPYlH
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_CONSTANT                                   ~1      'ABD%5Cdsgsdgf%5Csd%5CPHP_VERSION_ID'
          1        IS_SMALLER                                               ~1, 50400
          2      > JMPZ                                                     ~2, ->4
    5     3    > > RETURN                                                   null
   38     4    >   NEW                                              $3      'ABD%5Cdsgsdgf%5Csd%5CFoo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   40     7        INIT_METHOD_CALL                                         !0, 'recurseBenchCallerContex'
          8        SEND_VAL_EX                                              10000
          9        SEND_VAL_EX                                              100
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class ABD\dsgsdgf\sd\Foo:
Function recursebenchcallercontex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 49
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 55, Position 2 = 49
Branch analysis from position: 55
Branch analysis from position: 49
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
Branch analysis from position: 16
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 16
Branch analysis from position: 34
Branch analysis from position: 16
filename:       /in/DPYlH
function name:  recurseBenchCallerContex
number of ops:  64
compiled vars:  !0 = $iterations, !1 = $recursionLimit, !2 = $start, !3 = $c, !4 = $trace, !5 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        IS_SMALLER                                               0, !1
          3      > JMPZ                                                     ~6, ->10
   14     4    >   INIT_METHOD_CALL                                         'recurseBenchCallerContex'
          5        SEND_VAR_EX                                              !0
          6        SUB                                              ~7      !1, 1
          7        SEND_VAL_EX                                              ~7
          8        DO_FCALL                                      0  $8      
          9      > RETURN                                                   $8
   17    10    >   INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cmicrotime'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !2, $9
   19    14        ASSIGN                                                   !3, 0
         15      > JMP                                                      ->32
   20    16    >   INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cdebug_backtrace'
         17        FETCH_CONSTANT                                   ~12     'ABD%5Cdsgsdgf%5Csd%5CDEBUG_BACKTRACE_IGNORE_ARGS'
         18        SEND_VAL_EX                                              ~12
         19        SEND_VAL_EX                                              4
         20        DO_FCALL                                      0  $13     
         21        ASSIGN                                                   !4, $13
   21    22        FETCH_DIM_IS                                     ~15     !4, 1
         23        ISSET_ISEMPTY_DIM_OBJ                         0          ~15, 'class'
         24      > JMPZ                                                     ~16, ->29
         25    >   FETCH_DIM_R                                      ~17     !4, 1
         26        FETCH_DIM_R                                      ~18     ~17, 'class'
         27        QM_ASSIGN                                        ~19     ~18
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~19     null
         30    >   ASSIGN                                                   !5, ~19
   19    31        PRE_INC                                                  !3
         32    >   IS_SMALLER                                               !3, !0
         33      > JMPNZ                                                    ~22, ->16
   24    34    >   INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cvar_dump'
         35        SEND_VAL_EX                                              'debug_backtrace'
         36        SEND_VAR_EX                                              !4
         37        INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cmicrotime'
         38        SEND_VAL_EX                                              <true>
         39        DO_FCALL                                      0  $23     
         40        SUB                                              ~24     $23, !2
         41        SEND_VAL_EX                                              ~24
         42        DO_FCALL                                      0          
   26    43        INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cmicrotime'
         44        SEND_VAL_EX                                              <true>
         45        DO_FCALL                                      0  $26     
         46        ASSIGN                                                   !2, $26
   28    47        ASSIGN                                                   !3, 0
         48      > JMP                                                      ->53
   29    49    >   INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cget_called_class'
         50        DO_FCALL                                      0  $29     
         51        ASSIGN                                                   !5, $29
   28    52        PRE_INC                                                  !3
         53    >   IS_SMALLER                                               !3, !0
         54      > JMPNZ                                                    ~32, ->49
   32    55    >   INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cvar_dump'
         56        SEND_VAL_EX                                              'debug_backtrace+full'
         57        INIT_NS_FCALL_BY_NAME                                    'ABD%5Cdsgsdgf%5Csd%5Cmicrotime'
         58        SEND_VAL_EX                                              <true>
         59        DO_FCALL                                      0  $33     
         60        SUB                                              ~34     $33, !2
         61        SEND_VAL_EX                                              ~34
         62        DO_FCALL                                      0          
   34    63      > RETURN                                                   null

End of function recursebenchcallercontex

End of class ABD\dsgsdgf\sd\Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 1404 KiB | 21 Q