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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.38 ms | 1409 KiB | 23 Q