3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rand = []; $max = 10000; $keys=array(); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; $keys[] = $i; } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; } $keys = array_keys($rand); printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 10
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 39
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 39
Branch analysis from position: 50
Branch analysis from position: 39
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 10
Branch analysis from position: 23
Branch analysis from position: 10
filename:       /in/3RAU1
function name:  (null)
number of ops:  64
compiled vars:  !0 = $rand, !1 = $max, !2 = $keys, !3 = $start, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 10000
    7     2        ASSIGN                                                   !2, <array>
    8     3        ASSIGN                                                   !1, 1000
    9     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !3, $9
   11     8        ASSIGN                                                   !4, 0
          9      > JMP                                                      ->21
   12    10    >   INIT_FCALL                                               'bin2hex'
         11        INIT_FCALL                                               'random_bytes'
         12        SEND_VAL                                                 10
         13        DO_ICALL                                         $12     
         14        SEND_VAR                                                 $12
         15        DO_ICALL                                         $13     
         16        ASSIGN_DIM                                               !0, $13
         17        OP_DATA                                                  !4
   13    18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  !4
   11    20        PRE_INC                                                  !4
         21    >   IS_SMALLER                                               !4, !1
         22      > JMPNZ                                                    ~17, ->10
   16    23    >   INIT_FCALL                                               'printf'
         24        SEND_VAL                                                 'Took+%25.7f+seconds+per+execution%0A'
         25        INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $18     
         28        SUB                                              ~19     $18, !3
         29        DIV                                              ~20     ~19, !1
         30        SEND_VAL                                                 ~20
         31        DO_ICALL                                                 
   18    32        ASSIGN                                                   !1, 1000
   19    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $23     
         36        ASSIGN                                                   !3, $23
   21    37        ASSIGN                                                   !4, 0
         38      > JMP                                                      ->48
   22    39    >   INIT_FCALL                                               'bin2hex'
         40        INIT_FCALL                                               'random_bytes'
         41        SEND_VAL                                                 10
         42        DO_ICALL                                         $26     
         43        SEND_VAR                                                 $26
         44        DO_ICALL                                         $27     
         45        ASSIGN_DIM                                               !0, $27
         46        OP_DATA                                                  !4
   21    47        PRE_INC                                                  !4
         48    >   IS_SMALLER                                               !4, !1
         49      > JMPNZ                                                    ~30, ->39
   24    50    >   INIT_FCALL                                               'array_keys'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                         $31     
         53        ASSIGN                                                   !2, $31
   26    54        INIT_FCALL                                               'printf'
         55        SEND_VAL                                                 'Took+%25.7f+seconds+per+execution%0A'
         56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $33     
         59        SUB                                              ~34     $33, !3
         60        DIV                                              ~35     ~34, !1
         61        SEND_VAL                                                 ~35
         62        DO_ICALL                                                 
         63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.21 ms | 1011 KiB | 18 Q