3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(0); echo "<pre>"; function m1($total) { for($i = 0; $i < $total; $i ++) hash('md5', 'string'); } function m2($total) { for($i = 0; $i < $total; $i ++) md5('string'); } function m3($total) { for($i = 0; $i < $total; $i ++) hash('sha1', 'string'); } function m4($total) { for($i = 0; $i < $total; $i ++) sha1('string'); } function m5($total) { for($i = 0; $i < $total; $i ++) hash('md5', $i); } function m6($total) { for($i = 0; $i < $total; $i ++) md5($i); } function m7($total) { for($i = 0; $i < $total; $i ++) hash('sha1', $i); } function m8($total) { for($i = 0; $i < $total; $i ++) sha1($i); } $result = array( 'm1' => 0, 'm2' => 0, 'm3' => 0, 'm4' => 0, 'm5' => 0, 'm6' => 0, 'm7' => 0, 'm8' => 0 ); $total = 10000; for($i = 0; $i < 100; ++ $i) { foreach ( array_keys($result) as $key ) { $alpha = microtime(true); $key($total); $result[$key] += microtime(true) - $alpha; } } echo '<pre>'; echo "Single Run\n"; print_r($result); echo '</pre>'; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 8
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 8
Branch analysis from position: 31
Branch analysis from position: 8
Branch analysis from position: 27
filename:       /in/J7pYF
function name:  (null)
number of ops:  38
compiled vars:  !0 = $result, !1 = $total, !2 = $i, !3 = $key, !4 = $alpha
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'set_time_limit'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    3     3        ECHO                                                     '%3Cpre%3E'
   45     4        ASSIGN                                                   !0, <array>
   56     5        ASSIGN                                                   !1, 10000
   58     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->29
   59     8    >   INIT_FCALL                                               'array_keys'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $9      
         11      > FE_RESET_R                                       $10     $9, ->27
         12    > > FE_FETCH_R                                               $10, !3, ->27
   60    13    >   INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !4, $11
   61    17        INIT_DYNAMIC_CALL                                        !3
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
   62    20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $15     
         23        SUB                                              ~16     $15, !4
         24        ASSIGN_DIM_OP                +=               1          !0, !3
         25        OP_DATA                                                  ~16
   59    26      > JMP                                                      ->12
         27    >   FE_FREE                                                  $10
   58    28        PRE_INC                                                  !2
         29    >   IS_SMALLER                                               !2, 100
         30      > JMPNZ                                                    ~18, ->8
   66    31    >   ECHO                                                     '%3Cpre%3E'
   67    32        ECHO                                                     'Single+Run%0A'
   68    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                                 
   69    36        ECHO                                                     '%3C%2Fpre%3E'
   71    37      > RETURN                                                   1

Function m1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m1
number of ops:  11
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
    7     3    >   INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'md5'
          5        SEND_VAL                                                 'string'
          6        DO_ICALL                                                 
    6     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPNZ                                                    ~5, ->3
    8    10    > > RETURN                                                   null

End of function m1

Function m2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m2
number of ops:  10
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
   12     3    >   INIT_FCALL                                               'md5'
          4        SEND_VAL                                                 'string'
          5        DO_ICALL                                                 
   11     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, !0
          8      > JMPNZ                                                    ~5, ->3
   13     9    > > RETURN                                                   null

End of function m2

Function m3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m3
number of ops:  11
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   17     3    >   INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'sha1'
          5        SEND_VAL                                                 'string'
          6        DO_ICALL                                                 
   16     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPNZ                                                    ~5, ->3
   18    10    > > RETURN                                                   null

End of function m3

Function m4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m4
number of ops:  10
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
   22     3    >   INIT_FCALL                                               'sha1'
          4        SEND_VAL                                                 'string'
          5        DO_ICALL                                                 
   21     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, !0
          8      > JMPNZ                                                    ~5, ->3
   23     9    > > RETURN                                                   null

End of function m4

Function m5:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m5
number of ops:  11
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   27     3    >   INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'md5'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   26     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPNZ                                                    ~5, ->3
   28    10    > > RETURN                                                   null

End of function m5

Function m6:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m6
number of ops:  10
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
   32     3    >   INIT_FCALL                                               'md5'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                                 
   31     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, !0
          8      > JMPNZ                                                    ~5, ->3
   33     9    > > RETURN                                                   null

End of function m6

Function m7:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m7
number of ops:  11
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   36     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->8
   37     3    >   INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'sha1'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   36     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPNZ                                                    ~5, ->3
   38    10    > > RETURN                                                   null

End of function m7

Function m8:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/J7pYF
function name:  m8
number of ops:  10
compiled vars:  !0 = $total, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   41     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
   42     3    >   INIT_FCALL                                               'sha1'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                                 
   41     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, !0
          8      > JMPNZ                                                    ~5, ->3
   43     9    > > RETURN                                                   null

End of function m8

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.29 ms | 1412 KiB | 27 Q