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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.64 ms | 1404 KiB | 25 Q