3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = 1000000; $max = 5000001; for( $i = 1; $i <= $max; $i += 10000 ) { //create lookup array $array = array_fill( 0, $i, NULL ); //build test indexes $test_indexes = array(); for( $j = 0; $j < $tests; $j++ ) { $test_indexes[] = rand( 0, $i-1 ); } //benchmark array lookups $start = microtime( TRUE ); foreach( $test_indexes as $test_index ) { $value = $array[ $test_index ]; unset( $value ); } $stop = microtime( TRUE ); unset( $array, $test_indexes, $test_index ); printf( "%d,%1.15f\n", $i, $stop - $start ); //time per 1mil lookups unset( $stop, $start ); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 4
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 52, Position 2 = 4
Branch analysis from position: 52
Branch analysis from position: 4
Branch analysis from position: 33
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 13
Branch analysis from position: 23
Branch analysis from position: 13
filename:       /in/3Q4W8
function name:  (null)
number of ops:  53
compiled vars:  !0 = $tests, !1 = $max, !2 = $i, !3 = $array, !4 = $test_indexes, !5 = $j, !6 = $start, !7 = $test_index, !8 = $value, !9 = $stop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1000000
    3     1        ASSIGN                                                   !1, 5000001
    6     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->50
    8     4    >   INIT_FCALL                                               'array_fill'
          5        SEND_VAL                                                 0
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 null
          8        DO_ICALL                                         $13     
          9        ASSIGN                                                   !3, $13
   11    10        ASSIGN                                                   !4, <array>
   12    11        ASSIGN                                                   !5, 0
         12      > JMP                                                      ->21
   13    13    >   INIT_FCALL                                               'rand'
         14        SEND_VAL                                                 0
         15        SUB                                              ~18     !2, 1
         16        SEND_VAL                                                 ~18
         17        DO_ICALL                                         $19     
         18        ASSIGN_DIM                                               !4
         19        OP_DATA                                                  $19
   12    20        PRE_INC                                                  !5
         21    >   IS_SMALLER                                               !5, !0
         22      > JMPNZ                                                    ~21, ->13
   17    23    >   INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $22     
         26        ASSIGN                                                   !6, $22
   18    27      > FE_RESET_R                                       $24     !4, ->33
         28    > > FE_FETCH_R                                               $24, !7, ->33
   19    29    >   FETCH_DIM_R                                      ~25     !3, !7
         30        ASSIGN                                                   !8, ~25
   20    31        UNSET_CV                                                 !8
   18    32      > JMP                                                      ->28
         33    >   FE_FREE                                                  $24
   22    34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $27     
         37        ASSIGN                                                   !9, $27
   23    38        UNSET_CV                                                 !3
         39        UNSET_CV                                                 !4
         40        UNSET_CV                                                 !7
   25    41        INIT_FCALL                                               'printf'
         42        SEND_VAL                                                 '%25d%2C%251.15f%0A'
         43        SEND_VAR                                                 !2
         44        SUB                                              ~29     !9, !6
         45        SEND_VAL                                                 ~29
         46        DO_ICALL                                                 
   26    47        UNSET_CV                                                 !9
         48        UNSET_CV                                                 !6
    6    49        ASSIGN_OP                                     1          !2, 10000
         50    >   IS_SMALLER_OR_EQUAL                                      !2, !1
         51      > JMPNZ                                                    ~32, ->4
   27    52    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.73 ms | 1400 KiB | 21 Q