3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.96 ms | 1400 KiB | 23 Q