3v4l.org

run code in 300+ PHP versions simultaneously
<?php for($size = 10; $size < 500; $size *= 2) { echo PHP_EOL . "Testing size: $size" . PHP_EOL; for($s = microtime(true), $container = array(), $i = 0; $i < $size; $i++) $container[$i] = NULL; echo "Array(): " . sprintf('%f', (microtime(true) - $s)) . ', mem: ' . sprintf('%f', memory_get_usage()) . PHP_EOL; for($s = microtime(true), $container = new SplFixedArray($size), $i = 0; $i < $size; $i++) $container[$i] = NULL; echo "SplArray(): " . sprintf('%f', (microtime(true) - $s)) . ', mem: ' . sprintf('%f', memory_get_usage()) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 2
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 14
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 48
Branch analysis from position: 53
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 2
Branch analysis from position: 75
Branch analysis from position: 2
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 48
Branch analysis from position: 53
Branch analysis from position: 48
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 14
Branch analysis from position: 19
Branch analysis from position: 14
filename:       /in/3T8bF
function name:  (null)
number of ops:  76
compiled vars:  !0 = $size, !1 = $s, !2 = $container, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 10
          1      > JMP                                                      ->73
    4     2    >   NOP                                                      
          3        FAST_CONCAT                                      ~5      'Testing+size%3A+', !0
          4        CONCAT                                           ~6      '%0A', ~5
          5        CONCAT                                           ~7      ~6, '%0A'
          6        ECHO                                                     ~7
    5     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !1, $8
         11        ASSIGN                                                   !2, <array>
         12        ASSIGN                                                   !3, 0
         13      > JMP                                                      ->17
         14    >   ASSIGN_DIM                                               !2, !3
         15        OP_DATA                                                  null
         16        PRE_INC                                                  !3
         17    >   IS_SMALLER                                               !3, !0
         18      > JMPNZ                                                    ~14, ->14
    6    19    >   INIT_FCALL                                               'sprintf'
         20        SEND_VAL                                                 '%25f'
         21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $15     
         24        SUB                                              ~16     $15, !1
         25        SEND_VAL                                                 ~16
         26        DO_ICALL                                         $17     
         27        CONCAT                                           ~18     'Array%28%29%3A+', $17
         28        CONCAT                                           ~19     ~18, '%2C+mem%3A+'
         29        INIT_FCALL                                               'sprintf'
         30        SEND_VAL                                                 '%25f'
         31        INIT_FCALL                                               'memory_get_usage'
         32        DO_ICALL                                         $20     
         33        SEND_VAR                                                 $20
         34        DO_ICALL                                         $21     
         35        CONCAT                                           ~22     ~19, $21
         36        CONCAT                                           ~23     ~22, '%0A'
         37        ECHO                                                     ~23
    8    38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !1, $24
         42        NEW                                              $26     'SplFixedArray'
         43        SEND_VAR_EX                                              !0
         44        DO_FCALL                                      0          
         45        ASSIGN                                                   !2, $26
         46        ASSIGN                                                   !3, 0
         47      > JMP                                                      ->51
         48    >   ASSIGN_DIM                                               !2, !3
         49        OP_DATA                                                  null
         50        PRE_INC                                                  !3
         51    >   IS_SMALLER                                               !3, !0
         52      > JMPNZ                                                    ~32, ->48
    9    53    >   INIT_FCALL                                               'sprintf'
         54        SEND_VAL                                                 '%25f'
         55        INIT_FCALL                                               'microtime'
         56        SEND_VAL                                                 <true>
         57        DO_ICALL                                         $33     
         58        SUB                                              ~34     $33, !1
         59        SEND_VAL                                                 ~34
         60        DO_ICALL                                         $35     
         61        CONCAT                                           ~36     'SplArray%28%29%3A+', $35
         62        CONCAT                                           ~37     ~36, '%2C+mem%3A+'
         63        INIT_FCALL                                               'sprintf'
         64        SEND_VAL                                                 '%25f'
         65        INIT_FCALL                                               'memory_get_usage'
         66        DO_ICALL                                         $38     
         67        SEND_VAR                                                 $38
         68        DO_ICALL                                         $39     
         69        CONCAT                                           ~40     ~37, $39
         70        CONCAT                                           ~41     ~40, '%0A'
         71        ECHO                                                     ~41
    3    72        ASSIGN_OP                                     3          !0, 2
         73    >   IS_SMALLER                                               !0, 500
         74      > JMPNZ                                                    ~43, ->2
   10    75    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.79 ms | 1400 KiB | 19 Q