3v4l.org

run code in 300+ PHP versions simultaneously
<?php $amount = 100000; $size = 15; $data = []; for ($i = 0; $i < $size; ++$i) { $data[$i] = rand(0, 1) ? bin2hex(random_bytes(3)) : null; } $start = microtime(true); for ($lap = 0; $lap < $amount; ++$lap) { $dataFiltered = []; for ($i = 0; $i < $size; ++$i) { if (!is_null($data[$i])) { $dataFiltered[$i] = $data[$i]; } } } $time = microtime(true) - $start; echo "Manual: $time\n"; $start = microtime(true); for ($lap = 0; $lap < $amount; ++$lap) { $dataFiltered = array_filter($data, function($value) { return !is_null($value); }); } $time = microtime(true) - $start; echo "Auto: $time\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 30
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 61
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 61
Branch analysis from position: 70
Branch analysis from position: 61
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 33
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 30
Branch analysis from position: 46
Branch analysis from position: 30
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 33
Branch analysis from position: 43
Branch analysis from position: 33
Branch analysis from position: 40
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
Branch analysis from position: 5
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 5
Branch analysis from position: 24
Branch analysis from position: 5
filename:       /in/cgvdk
function name:  (null)
number of ops:  80
compiled vars:  !0 = $amount, !1 = $size, !2 = $data, !3 = $i, !4 = $start, !5 = $lap, !6 = $dataFiltered, !7 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 100000
    4     1        ASSIGN                                                   !1, 15
    6     2        ASSIGN                                                   !2, <array>
    7     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->22
    8     5    >   INIT_FCALL                                               'rand'
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $13     
          9      > JMPZ                                                     $13, ->18
         10    >   INIT_FCALL                                               'bin2hex'
         11        INIT_FCALL                                               'random_bytes'
         12        SEND_VAL                                                 3
         13        DO_ICALL                                         $14     
         14        SEND_VAR                                                 $14
         15        DO_ICALL                                         $15     
         16        QM_ASSIGN                                        ~16     $15
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~16     null
         19    >   ASSIGN_DIM                                               !2, !3
         20        OP_DATA                                                  ~16
    7    21        PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, !1
         23      > JMPNZ                                                    ~18, ->5
   11    24    >   INIT_FCALL                                               'microtime'
         25        SEND_VAL                                                 <true>
         26        DO_ICALL                                         $19     
         27        ASSIGN                                                   !4, $19
   12    28        ASSIGN                                                   !5, 0
         29      > JMP                                                      ->44
   13    30    >   ASSIGN                                                   !6, <array>
   14    31        ASSIGN                                                   !3, 0
         32      > JMP                                                      ->41
   15    33    >   FETCH_DIM_R                                      ~24     !2, !3
         34        TYPE_CHECK                                    2  ~25     ~24
         35        BOOL_NOT                                         ~26     ~25
         36      > JMPZ                                                     ~26, ->40
   16    37    >   FETCH_DIM_R                                      ~28     !2, !3
         38        ASSIGN_DIM                                               !6, !3
         39        OP_DATA                                                  ~28
   14    40    >   PRE_INC                                                  !3
         41    >   IS_SMALLER                                               !3, !1
         42      > JMPNZ                                                    ~30, ->33
   12    43    >   PRE_INC                                                  !5
         44    >   IS_SMALLER                                               !5, !0
         45      > JMPNZ                                                    ~32, ->30
   20    46    >   INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $33     
         49        SUB                                              ~34     $33, !4
         50        ASSIGN                                                   !7, ~34
   21    51        ROPE_INIT                                     3  ~37     'Manual%3A+'
         52        ROPE_ADD                                      1  ~37     ~37, !7
         53        ROPE_END                                      2  ~36     ~37, '%0A'
         54        ECHO                                                     ~36
   23    55        INIT_FCALL                                               'microtime'
         56        SEND_VAL                                                 <true>
         57        DO_ICALL                                         $39     
         58        ASSIGN                                                   !4, $39
   24    59        ASSIGN                                                   !5, 0
         60      > JMP                                                      ->68
   25    61    >   INIT_FCALL                                               'array_filter'
         62        SEND_VAR                                                 !2
         63        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fcgvdk%3A25%240'
   28    64        SEND_VAL                                                 ~42
         65        DO_ICALL                                         $43     
   25    66        ASSIGN                                                   !6, $43
   24    67        PRE_INC                                                  !5
         68    >   IS_SMALLER                                               !5, !0
         69      > JMPNZ                                                    ~46, ->61
   30    70    >   INIT_FCALL                                               'microtime'
         71        SEND_VAL                                                 <true>
         72        DO_ICALL                                         $47     
         73        SUB                                              ~48     $47, !4
         74        ASSIGN                                                   !7, ~48
   31    75        ROPE_INIT                                     3  ~51     'Auto%3A+'
         76        ROPE_ADD                                      1  ~51     ~51, !7
         77        ROPE_END                                      2  ~50     ~51, '%0A'
         78        ECHO                                                     ~50
         79      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fcgvdk%3A25%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cgvdk
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   27     1        TYPE_CHECK                                    2  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > RETURN                                                   ~2
   28     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fcgvdk%3A25%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.76 ms | 1404 KiB | 23 Q