3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(version_compare(PHP_VERSION, '5.0') <= 0) { die('Skipped PHP version: ' . PHP_VERSION); } // Setup $class = 'Concrete5_Model_User'; $count = 10000; // Warm up for($i = 0; $i < $count; $i++) { strpos($class, 'Concrete5_Model_'); } // Test - case sensitive $t0 = microtime(true); for($i = 0; $i < $count; $i++) { if(strpos($class, 'Concrete5_Model_') === 0) { } } $deltaCS = microtime(true) - $t0; // Test - case insensitive $t0 = microtime(true); for($i = 0; $i < $count; $i++) { if(stripos($class, 'Concrete5_Model_') === 0) { } } $deltaCI = microtime(true) - $t0; // Write results echo "case sensitive: ", round($deltaCS * 1000, 2), " ms\n"; echo "case insensitive: ", round($deltaCI * 1000, 2), " ms\n"; echo "case sensitive gain: ", round($deltaCI * 100 / $deltaCS - 100, 2), " %\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 11
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 44
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 50
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 44
Branch analysis from position: 53
Branch analysis from position: 44
Branch analysis from position: 50
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
Branch analysis from position: 24
Branch analysis from position: 30
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 11
Branch analysis from position: 18
Branch analysis from position: 11
filename:       /in/3GC1s
function name:  (null)
number of ops:  85
compiled vars:  !0 = $class, !1 = $count, !2 = $i, !3 = $t0, !4 = $deltaCS, !5 = $deltaCI
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'version_compare'
          1        SEND_VAL                                                 '8.0.0'
          2        SEND_VAL                                                 '5.0'
          3        DO_ICALL                                         $6      
          4        IS_SMALLER_OR_EQUAL                                      $6, 0
          5      > JMPZ                                                     ~7, ->7
    3     6    > > EXIT                                                     'Skipped+PHP+version%3A+8.0.0'
    6     7    >   ASSIGN                                                   !0, 'Concrete5_Model_User'
    7     8        ASSIGN                                                   !1, 10000
   10     9        ASSIGN                                                   !2, 0
         10      > JMP                                                      ->16
   11    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'Concrete5_Model_'
         14        DO_ICALL                                                 
   10    15        PRE_INC                                                  !2
         16    >   IS_SMALLER                                               !2, !1
         17      > JMPNZ                                                    ~13, ->11
   15    18    >   INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $14     
         21        ASSIGN                                                   !3, $14
   16    22        ASSIGN                                                   !2, 0
         23      > JMP                                                      ->31
   17    24    >   INIT_FCALL                                               'strpos'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 'Concrete5_Model_'
         27        DO_ICALL                                         $17     
         28        IS_IDENTICAL                                             $17, 0
         29      > JMPZ                                                     ~18, ->30
   16    30    >   PRE_INC                                                  !2
         31    >   IS_SMALLER                                               !2, !1
         32      > JMPNZ                                                    ~20, ->24
   20    33    >   INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $21     
         36        SUB                                              ~22     $21, !3
         37        ASSIGN                                                   !4, ~22
   24    38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !3, $24
   25    42        ASSIGN                                                   !2, 0
         43      > JMP                                                      ->51
   26    44    >   INIT_FCALL                                               'stripos'
         45        SEND_VAR                                                 !0
         46        SEND_VAL                                                 'Concrete5_Model_'
         47        DO_ICALL                                         $27     
         48        IS_IDENTICAL                                             $27, 0
         49      > JMPZ                                                     ~28, ->50
   25    50    >   PRE_INC                                                  !2
         51    >   IS_SMALLER                                               !2, !1
         52      > JMPNZ                                                    ~30, ->44
   29    53    >   INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $31     
         56        SUB                                              ~32     $31, !3
         57        ASSIGN                                                   !5, ~32
   32    58        ECHO                                                     'case+sensitive%3A+'
         59        INIT_FCALL                                               'round'
         60        MUL                                              ~34     !4, 1000
         61        SEND_VAL                                                 ~34
         62        SEND_VAL                                                 2
         63        DO_ICALL                                         $35     
         64        ECHO                                                     $35
         65        ECHO                                                     '+ms%0A'
   33    66        ECHO                                                     'case+insensitive%3A+'
         67        INIT_FCALL                                               'round'
         68        MUL                                              ~36     !5, 1000
         69        SEND_VAL                                                 ~36
         70        SEND_VAL                                                 2
         71        DO_ICALL                                         $37     
         72        ECHO                                                     $37
         73        ECHO                                                     '+ms%0A'
   34    74        ECHO                                                     'case+sensitive+gain%3A+'
         75        INIT_FCALL                                               'round'
         76        MUL                                              ~38     !5, 100
         77        DIV                                              ~39     ~38, !4
         78        SUB                                              ~40     ~39, 100
         79        SEND_VAL                                                 ~40
         80        SEND_VAL                                                 2
         81        DO_ICALL                                         $41     
         82        ECHO                                                     $41
         83        ECHO                                                     '+%25%0A'
         84      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.06 ms | 1404 KiB | 23 Q