3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class IndexRange { /** * @param 0|positive-int $start * @param 0|positive-int $end */ public function __construct(public int $start, public int $end) { } } function acceptOne($a) {}; function acceptTwo($a, $b) {}; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $start = $i; $end = $i; acceptTwo($start, $end); } echo '2 vars: ' . round((microtime(true) - $t) * 1000, 2) . " ms\n"; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $rangeArr = [$i, $i]; acceptOne($rangeArr); } echo 'range arr: ' . round((microtime(true) - $t) * 1000, 2) . " ms\n"; $t = microtime(true); for ($i = 0; $i < 100_000; $i++) { $rangeObj = new IndexRange($i, $i); acceptOne($rangeObj); } echo 'range obj: ' . round((microtime(true) - $t) * 1000, 2) . " 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 = 6
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 33
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 60
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 60
Branch analysis from position: 71
Branch analysis from position: 60
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 33
Branch analysis from position: 42
Branch analysis from position: 33
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 6
Branch analysis from position: 15
Branch analysis from position: 6
filename:       /in/hSSFJ
function name:  (null)
number of ops:  84
compiled vars:  !0 = $t, !1 = $i, !2 = $start, !3 = $end, !4 = $rangeArr, !5 = $rangeObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
   18     4        ASSIGN                                                   !1, 0
          5      > JMP                                                      ->13
   19     6    >   ASSIGN                                                   !2, !1
   20     7        ASSIGN                                                   !3, !1
   21     8        INIT_FCALL                                               'accepttwo'
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !3
         11        DO_FCALL                                      0          
   18    12        PRE_INC                                                  !1
         13    >   IS_SMALLER                                               !1, 100000
         14      > JMPNZ                                                    ~13, ->6
   23    15    >   INIT_FCALL                                               'round'
         16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $14     
         19        SUB                                              ~15     $14, !0
         20        MUL                                              ~16     ~15, 1000
         21        SEND_VAL                                                 ~16
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $17     
         24        CONCAT                                           ~18     '2+vars%3A+', $17
         25        CONCAT                                           ~19     ~18, '+ms%0A'
         26        ECHO                                                     ~19
   25    27        INIT_FCALL                                               'microtime'
         28        SEND_VAL                                                 <true>
         29        DO_ICALL                                         $20     
         30        ASSIGN                                                   !0, $20
   26    31        ASSIGN                                                   !1, 0
         32      > JMP                                                      ->40
   27    33    >   INIT_ARRAY                                       ~23     !1
         34        ADD_ARRAY_ELEMENT                                ~23     !1
         35        ASSIGN                                                   !4, ~23
   28    36        INIT_FCALL                                               'acceptone'
         37        SEND_VAR                                                 !4
         38        DO_FCALL                                      0          
   26    39        PRE_INC                                                  !1
         40    >   IS_SMALLER                                               !1, 100000
         41      > JMPNZ                                                    ~27, ->33
   30    42    >   INIT_FCALL                                               'round'
         43        INIT_FCALL                                               'microtime'
         44        SEND_VAL                                                 <true>
         45        DO_ICALL                                         $28     
         46        SUB                                              ~29     $28, !0
         47        MUL                                              ~30     ~29, 1000
         48        SEND_VAL                                                 ~30
         49        SEND_VAL                                                 2
         50        DO_ICALL                                         $31     
         51        CONCAT                                           ~32     'range+arr%3A+', $31
         52        CONCAT                                           ~33     ~32, '+ms%0A'
         53        ECHO                                                     ~33
   32    54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $34     
         57        ASSIGN                                                   !0, $34
   33    58        ASSIGN                                                   !1, 0
         59      > JMP                                                      ->69
   34    60    >   NEW                                              $37     'IndexRange'
         61        SEND_VAR_EX                                              !1
         62        SEND_VAR_EX                                              !1
         63        DO_FCALL                                      0          
         64        ASSIGN                                                   !5, $37
   35    65        INIT_FCALL                                               'acceptone'
         66        SEND_VAR                                                 !5
         67        DO_FCALL                                      0          
   33    68        PRE_INC                                                  !1
         69    >   IS_SMALLER                                               !1, 100000
         70      > JMPNZ                                                    ~42, ->60
   37    71    >   INIT_FCALL                                               'round'
         72        INIT_FCALL                                               'microtime'
         73        SEND_VAL                                                 <true>
         74        DO_ICALL                                         $43     
         75        SUB                                              ~44     $43, !0
         76        MUL                                              ~45     ~44, 1000
         77        SEND_VAL                                                 ~45
         78        SEND_VAL                                                 2
         79        DO_ICALL                                         $46     
         80        CONCAT                                           ~47     'range+obj%3A+', $46
         81        CONCAT                                           ~48     ~47, '+ms%0A'
         82        ECHO                                                     ~48
         83      > RETURN                                                   1

Function acceptone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hSSFJ
function name:  acceptOne
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function acceptone

Function accepttwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hSSFJ
function name:  acceptTwo
number of ops:  3
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function accepttwo

Class IndexRange:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hSSFJ
function name:  __construct
number of ops:  7
compiled vars:  !0 = $start, !1 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        ASSIGN_OBJ                                               'start'
          3        OP_DATA                                                  !0
          4        ASSIGN_OBJ                                               'end'
          5        OP_DATA                                                  !1
   11     6      > RETURN                                                   null

End of function __construct

End of class IndexRange.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.52 ms | 1010 KiB | 18 Q