3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t = microtime(true); $n = 100000; $max = 10; $m = memory_get_usage(true); echo 'Serialize' . PHP_EOL; for($i = 0; $i < $max; $i++) { $a = new SplFixedArray($n); for($i = 0; $i < $n; $i++) { $a[$i] = (int)$i; } } echo 'Peak: ' . memory_get_peak_usage(true) . PHP_EOL; echo 'Usage: ' . (memory_get_usage(true) - $m) . PHP_EOL . PHP_EOL; $content = serialize($a); $a = null; $t = microtime(true); $m = memory_get_usage(true); echo 'Unserialize' . PHP_EOL; for($i = 0; $i < $max; $i++) { $a = unserialize($content); } echo 'Peak: ' . memory_get_peak_usage(true) . PHP_EOL; echo 'Usage: ' . (memory_get_usage(true) - $m) . PHP_EOL; echo 'Time: ' . (microtime(true) - $t) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 13
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 63
Branch analysis from position: 63
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 58
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 65, Position 2 = 58
Branch analysis from position: 65
Branch analysis from position: 58
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 19
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 13
Branch analysis from position: 28
Branch analysis from position: 13
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 19
Branch analysis from position: 25
Branch analysis from position: 19
filename:       /in/ULO2s
function name:  (null)
number of ops:  86
compiled vars:  !0 = $t, !1 = $n, !2 = $max, !3 = $m, !4 = $i, !5 = $a, !6 = $content
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $7      
          3        ASSIGN                                                   !0, $7
    4     4        ASSIGN                                                   !1, 100000
    5     5        ASSIGN                                                   !2, 10
    6     6        INIT_FCALL                                               'memory_get_usage'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !3, $11
    8    10        ECHO                                                     'Serialize%0A'
    9    11        ASSIGN                                                   !4, 0
         12      > JMP                                                      ->26
   10    13    >   NEW                                              $14     'SplFixedArray'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !5, $14
   11    17        ASSIGN                                                   !4, 0
         18      > JMP                                                      ->23
   12    19    >   CAST                                          4  ~19     !4
         20        ASSIGN_DIM                                               !5, !4
         21        OP_DATA                                                  ~19
   11    22        PRE_INC                                                  !4
         23    >   IS_SMALLER                                               !4, !1
         24      > JMPNZ                                                    ~21, ->19
    9    25    >   PRE_INC                                                  !4
         26    >   IS_SMALLER                                               !4, !2
         27      > JMPNZ                                                    ~23, ->13
   16    28    >   INIT_FCALL                                               'memory_get_peak_usage'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $24     
         31        CONCAT                                           ~25     'Peak%3A+', $24
         32        CONCAT                                           ~26     ~25, '%0A'
         33        ECHO                                                     ~26
   17    34        INIT_FCALL                                               'memory_get_usage'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $27     
         37        SUB                                              ~28     $27, !3
         38        CONCAT                                           ~29     'Usage%3A+', ~28
         39        CONCAT                                           ~30     ~29, '%0A'
         40        CONCAT                                           ~31     ~30, '%0A'
         41        ECHO                                                     ~31
   19    42        INIT_FCALL                                               'serialize'
         43        SEND_VAR                                                 !5
         44        DO_ICALL                                         $32     
         45        ASSIGN                                                   !6, $32
   20    46        ASSIGN                                                   !5, null
   21    47        INIT_FCALL                                               'microtime'
         48        SEND_VAL                                                 <true>
         49        DO_ICALL                                         $35     
         50        ASSIGN                                                   !0, $35
   22    51        INIT_FCALL                                               'memory_get_usage'
         52        SEND_VAL                                                 <true>
         53        DO_ICALL                                         $37     
         54        ASSIGN                                                   !3, $37
   24    55        ECHO                                                     'Unserialize%0A'
   25    56        ASSIGN                                                   !4, 0
         57      > JMP                                                      ->63
   26    58    >   INIT_FCALL                                               'unserialize'
         59        SEND_VAR                                                 !6
         60        DO_ICALL                                         $40     
         61        ASSIGN                                                   !5, $40
   25    62        PRE_INC                                                  !4
         63    >   IS_SMALLER                                               !4, !2
         64      > JMPNZ                                                    ~43, ->58
   29    65    >   INIT_FCALL                                               'memory_get_peak_usage'
         66        SEND_VAL                                                 <true>
         67        DO_ICALL                                         $44     
         68        CONCAT                                           ~45     'Peak%3A+', $44
         69        CONCAT                                           ~46     ~45, '%0A'
         70        ECHO                                                     ~46
   30    71        INIT_FCALL                                               'memory_get_usage'
         72        SEND_VAL                                                 <true>
         73        DO_ICALL                                         $47     
         74        SUB                                              ~48     $47, !3
         75        CONCAT                                           ~49     'Usage%3A+', ~48
         76        CONCAT                                           ~50     ~49, '%0A'
         77        ECHO                                                     ~50
   31    78        INIT_FCALL                                               'microtime'
         79        SEND_VAL                                                 <true>
         80        DO_ICALL                                         $51     
         81        SUB                                              ~52     $51, !0
         82        CONCAT                                           ~53     'Time%3A+', ~52
         83        CONCAT                                           ~54     ~53, '%0A'
         84        ECHO                                                     ~54
         85      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.29 ms | 1404 KiB | 23 Q