3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_COUNT = 1000000; // Fill an array with random ints $ints = []; for ($i = 0; $i < INT_COUNT; $i++){ $ints[] = rand(0, 255); } // Sort the ints sort($ints); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints[$i]; } $finish = microtime(true); printf("Time taken with sort(): %.3f seconds\n", $finish - $start); // Now do it again, but this time use an asort // Fill an array with random ints $ints = []; for ($i = 0; $i < INT_COUNT; $i++){ $ints[] = rand(0, 255); } // asort the ints asort($ints); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints[$i]; } $finish = microtime(true); printf("Time taken with asort(): %.3f seconds\n", $finish - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 4
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 23
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 41
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 60
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 60
Branch analysis from position: 66
Branch analysis from position: 60
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 41
Branch analysis from position: 51
Branch analysis from position: 41
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 23
Branch analysis from position: 29
Branch analysis from position: 23
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 4
Branch analysis from position: 14
Branch analysis from position: 4
filename:       /in/VL3ch
function name:  (null)
number of ops:  76
compiled vars:  !0 = $ints, !1 = $i, !2 = $start, !3 = $finish
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CONST                                            'INT_COUNT', 1000000
    5     1        ASSIGN                                                   !0, <array>
    6     2        ASSIGN                                                   !1, 0
          3      > JMP                                                      ->11
    7     4    >   INIT_FCALL                                               'rand'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 255
          7        DO_ICALL                                         $7      
          8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  $7
    6    10        PRE_INC                                                  !1
         11    >   FETCH_CONSTANT                                   ~9      'INT_COUNT'
         12        IS_SMALLER                                               !1, ~9
         13      > JMPNZ                                                    ~10, ->4
   11    14    >   INIT_FCALL                                               'sort'
         15        SEND_REF                                                 !0
         16        DO_ICALL                                                 
   13    17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
   16    21        ASSIGN                                                   !1, 0
         22      > JMP                                                      ->26
   17    23    >   FETCH_DIM_R                                      ~15     !0, !1
         24        FREE                                                     ~15
   16    25        PRE_INC                                                  !1
         26    >   FETCH_CONSTANT                                   ~17     'INT_COUNT'
         27        IS_SMALLER                                               !1, ~17
         28      > JMPNZ                                                    ~18, ->23
   20    29    >   INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $19     
         32        ASSIGN                                                   !3, $19
   21    33        INIT_FCALL                                               'printf'
         34        SEND_VAL                                                 'Time+taken+with+sort%28%29%3A+%25.3f+seconds%0A'
         35        SUB                                              ~21     !3, !2
         36        SEND_VAL                                                 ~21
         37        DO_ICALL                                                 
   28    38        ASSIGN                                                   !0, <array>
   29    39        ASSIGN                                                   !1, 0
         40      > JMP                                                      ->48
   30    41    >   INIT_FCALL                                               'rand'
         42        SEND_VAL                                                 0
         43        SEND_VAL                                                 255
         44        DO_ICALL                                         $26     
         45        ASSIGN_DIM                                               !0
         46        OP_DATA                                                  $26
   29    47        PRE_INC                                                  !1
         48    >   FETCH_CONSTANT                                   ~28     'INT_COUNT'
         49        IS_SMALLER                                               !1, ~28
         50      > JMPNZ                                                    ~29, ->41
   34    51    >   INIT_FCALL                                               'asort'
         52        SEND_REF                                                 !0
         53        DO_ICALL                                                 
   36    54        INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $31     
         57        ASSIGN                                                   !2, $31
   39    58        ASSIGN                                                   !1, 0
         59      > JMP                                                      ->63
   40    60    >   FETCH_DIM_R                                      ~34     !0, !1
         61        FREE                                                     ~34
   39    62        PRE_INC                                                  !1
         63    >   FETCH_CONSTANT                                   ~36     'INT_COUNT'
         64        IS_SMALLER                                               !1, ~36
         65      > JMPNZ                                                    ~37, ->60
   43    66    >   INIT_FCALL                                               'microtime'
         67        SEND_VAL                                                 <true>
         68        DO_ICALL                                         $38     
         69        ASSIGN                                                   !3, $38
   44    70        INIT_FCALL                                               'printf'
         71        SEND_VAL                                                 'Time+taken+with+asort%28%29%3A+%25.3f+seconds%0A'
         72        SUB                                              ~40     !3, !2
         73        SEND_VAL                                                 ~40
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.58 ms | 1400 KiB | 23 Q