3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bench { private $closure; public function __construct() { $this->closure = function ($foo) {}; } /** * @iterations 100000 */ public function nativeCall() { $this->closure->__invoke('test'); } /** * @iterations 100000 */ public function callUserFuncCall() { call_user_func($this->closure, 'test'); } } $bench = new Bench(); for($i=0;$i != 100000;$i++){ $bench->nativeCall(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/MLVEW
function name:  (null)
number of ops:  11
compiled vars:  !0 = $bench, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $2      'Bench'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   27     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->8
   28     5    >   INIT_METHOD_CALL                                         !0, 'nativeCall'
          6        DO_FCALL                                      0          
   27     7        PRE_INC                                                  !1
          8    >   IS_NOT_EQUAL                                             !1, 100000
          9      > JMPNZ                                                    ~8, ->5
   29    10    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FMLVEW%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MLVEW
function name:  {closure}
number of ops:  2
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FMLVEW%3A8%240

Class Bench:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MLVEW
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FMLVEW%3A8%240'
          1        ASSIGN_OBJ                                               'closure'
          2        OP_DATA                                                  ~1
    9     3      > RETURN                                                   null

End of function __construct

Function nativecall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MLVEW
function name:  nativeCall
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'closure'
          1        INIT_METHOD_CALL                                         ~0, '__invoke'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
   16     4      > RETURN                                                   null

End of function nativecall

Function calluserfunccall:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MLVEW
function name:  callUserFuncCall
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_OBJ_R                                      ~0      'closure'
          1        INIT_USER_CALL                                1          'call_user_func', ~0
          2        SEND_USER                                                'test'
          3        DO_FCALL                                      0          
   23     4      > RETURN                                                   null

End of function calluserfunccall

End of class Bench.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.73 ms | 1399 KiB | 13 Q