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 = array(); 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 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 55
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 55
Branch analysis from position: 62
Branch analysis from position: 55
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 13
Branch analysis from position: 25
Branch analysis from position: 13
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
Branch analysis from position: 16
filename:       /in/HroWG
function name:  (null)
number of ops:  83
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                                                      ->23
   10    13    >   ASSIGN                                                   !5, <array>
   11    14        ASSIGN                                                   !4, 0
         15      > JMP                                                      ->20
   12    16    >   CAST                                          4  ~17     !4
         17        ASSIGN_DIM                                               !5, !4
         18        OP_DATA                                                  ~17
   11    19        PRE_INC                                                  !4
         20    >   IS_SMALLER                                               !4, !1
         21      > JMPNZ                                                    ~19, ->16
    9    22    >   PRE_INC                                                  !4
         23    >   IS_SMALLER                                               !4, !2
         24      > JMPNZ                                                    ~21, ->13
   16    25    >   INIT_FCALL                                               'memory_get_peak_usage'
         26        SEND_VAL                                                 <true>
         27        DO_ICALL                                         $22     
         28        CONCAT                                           ~23     'Peak%3A+', $22
         29        CONCAT                                           ~24     ~23, '%0A'
         30        ECHO                                                     ~24
   17    31        INIT_FCALL                                               'memory_get_usage'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $25     
         34        SUB                                              ~26     $25, !3
         35        CONCAT                                           ~27     'Usage%3A+', ~26
         36        CONCAT                                           ~28     ~27, '%0A'
         37        CONCAT                                           ~29     ~28, '%0A'
         38        ECHO                                                     ~29
   19    39        INIT_FCALL                                               'serialize'
         40        SEND_VAR                                                 !5
         41        DO_ICALL                                         $30     
         42        ASSIGN                                                   !6, $30
   20    43        ASSIGN                                                   !5, null
   21    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $33     
         47        ASSIGN                                                   !0, $33
   22    48        INIT_FCALL                                               'memory_get_usage'
         49        SEND_VAL                                                 <true>
         50        DO_ICALL                                         $35     
         51        ASSIGN                                                   !3, $35
   24    52        ECHO                                                     'Unserialize%0A'
   25    53        ASSIGN                                                   !4, 0
         54      > JMP                                                      ->60
   26    55    >   INIT_FCALL                                               'unserialize'
         56        SEND_VAR                                                 !6
         57        DO_ICALL                                         $38     
         58        ASSIGN                                                   !5, $38
   25    59        PRE_INC                                                  !4
         60    >   IS_SMALLER                                               !4, !2
         61      > JMPNZ                                                    ~41, ->55
   29    62    >   INIT_FCALL                                               'memory_get_peak_usage'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $42     
         65        CONCAT                                           ~43     'Peak%3A+', $42
         66        CONCAT                                           ~44     ~43, '%0A'
         67        ECHO                                                     ~44
   30    68        INIT_FCALL                                               'memory_get_usage'
         69        SEND_VAL                                                 <true>
         70        DO_ICALL                                         $45     
         71        SUB                                              ~46     $45, !3
         72        CONCAT                                           ~47     'Usage%3A+', ~46
         73        CONCAT                                           ~48     ~47, '%0A'
         74        ECHO                                                     ~48
   31    75        INIT_FCALL                                               'microtime'
         76        SEND_VAL                                                 <true>
         77        DO_ICALL                                         $49     
         78        SUB                                              ~50     $49, !0
         79        CONCAT                                           ~51     'Time%3A+', ~50
         80        CONCAT                                           ~52     ~51, '%0A'
         81        ECHO                                                     ~52
         82      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.18 ms | 949 KiB | 24 Q