3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(version_compare(PHP_VERSION, '5.0') <= 0) { die('Skipped'); } // 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; // Test - substr $t0 = microtime(true); for($i = 0; $i < $count; $i++) { $ss = 'Concrete5_Model_'; if(substr($class, 0, strlen($ss)) === $ss) { } } $deltaSS = microtime(true) - $t0; echo "case sensitive: ", round($deltaCS * 1000, 2), " ms\n"; echo "case insensitive: ", round($deltaCI * 1000, 2), " ms\n"; echo "case substring: ", round($deltaSS * 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 = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 64
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 73
Branch analysis from position: 73
2 jumps found. (Code = 44) Position 1 = 76, Position 2 = 64
Branch analysis from position: 76
Branch analysis from position: 64
Branch analysis from position: 73
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/3HQsr
function name:  (null)
number of ops:  116
compiled vars:  !0 = $class, !1 = $count, !2 = $i, !3 = $t0, !4 = $deltaCS, !5 = $deltaCI, !6 = $ss, !7 = $deltaSS
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                                         $8      
          4        IS_SMALLER_OR_EQUAL                                      $8, 0
          5      > JMPZ                                                     ~9, ->7
    3     6    > > EXIT                                                     'Skipped'
    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                                                    ~15, ->11
   15    18    >   INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $16     
         21        ASSIGN                                                   !3, $16
   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                                         $19     
         28        IS_IDENTICAL                                             $19, 0
         29      > JMPZ                                                     ~20, ->30
   16    30    >   PRE_INC                                                  !2
         31    >   IS_SMALLER                                               !2, !1
         32      > JMPNZ                                                    ~22, ->24
   20    33    >   INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $23     
         36        SUB                                              ~24     $23, !3
         37        ASSIGN                                                   !4, ~24
   24    38        INIT_FCALL                                               'microtime'
         39        SEND_VAL                                                 <true>
         40        DO_ICALL                                         $26     
         41        ASSIGN                                                   !3, $26
   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                                         $29     
         48        IS_IDENTICAL                                             $29, 0
         49      > JMPZ                                                     ~30, ->50
   25    50    >   PRE_INC                                                  !2
         51    >   IS_SMALLER                                               !2, !1
         52      > JMPNZ                                                    ~32, ->44
   29    53    >   INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $33     
         56        SUB                                              ~34     $33, !3
         57        ASSIGN                                                   !5, ~34
   32    58        INIT_FCALL                                               'microtime'
         59        SEND_VAL                                                 <true>
         60        DO_ICALL                                         $36     
         61        ASSIGN                                                   !3, $36
   33    62        ASSIGN                                                   !2, 0
         63      > JMP                                                      ->74
   34    64    >   ASSIGN                                                   !6, 'Concrete5_Model_'
   35    65        INIT_FCALL                                               'substr'
         66        SEND_VAR                                                 !0
         67        SEND_VAL                                                 0
         68        STRLEN                                           ~40     !6
         69        SEND_VAL                                                 ~40
         70        DO_ICALL                                         $41     
         71        IS_IDENTICAL                                             !6, $41
         72      > JMPZ                                                     ~42, ->73
   33    73    >   PRE_INC                                                  !2
         74    >   IS_SMALLER                                               !2, !1
         75      > JMPNZ                                                    ~44, ->64
   38    76    >   INIT_FCALL                                               'microtime'
         77        SEND_VAL                                                 <true>
         78        DO_ICALL                                         $45     
         79        SUB                                              ~46     $45, !3
         80        ASSIGN                                                   !7, ~46
   41    81        ECHO                                                     'case+sensitive%3A+'
         82        INIT_FCALL                                               'round'
         83        MUL                                              ~48     !4, 1000
         84        SEND_VAL                                                 ~48
         85        SEND_VAL                                                 2
         86        DO_ICALL                                         $49     
         87        ECHO                                                     $49
         88        ECHO                                                     '+ms%0A'
   42    89        ECHO                                                     'case+insensitive%3A+'
         90        INIT_FCALL                                               'round'
         91        MUL                                              ~50     !5, 1000
         92        SEND_VAL                                                 ~50
         93        SEND_VAL                                                 2
         94        DO_ICALL                                         $51     
         95        ECHO                                                     $51
         96        ECHO                                                     '+ms%0A'
   43    97        ECHO                                                     'case+substring%3A+'
         98        INIT_FCALL                                               'round'
         99        MUL                                              ~52     !7, 1000
        100        SEND_VAL                                                 ~52
        101        SEND_VAL                                                 2
        102        DO_ICALL                                         $53     
        103        ECHO                                                     $53
        104        ECHO                                                     '+ms%0A'
   44   105        ECHO                                                     'case+sensitive+gain%3A+'
        106        INIT_FCALL                                               'round'
        107        MUL                                              ~54     !5, 100
        108        DIV                                              ~55     ~54, !4
        109        SUB                                              ~56     ~55, 100
        110        SEND_VAL                                                 ~56
        111        SEND_VAL                                                 2
        112        DO_ICALL                                         $57     
        113        ECHO                                                     $57
        114        ECHO                                                     '+%25%0A'
        115      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.96 ms | 1404 KiB | 25 Q