3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.89 ms | 1404 KiB | 25 Q