<?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";
- Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.27
- Parse error: syntax error, unexpected '{' in /in/tUtLb on line 35
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '{' in /in/tUtLb on line 35
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/tUtLb on line 35
Process exited with code 255.
preferences:
241.94 ms | 1395 KiB | 117 Q