@ 2014-04-03T12:45:51Z <?php
// Setup
$count = 1000;
function camelcaseCurrent($file) {
$r1 = ucwords(str_replace(array('_', '-', '/'), ' ', $file));
$r2 = str_replace(' ', '', $r1);
return $r2;
}
function camelcaseNew($file) {
$r1 = ucwords(str_replace(array('_', '-', '/'), '', $file));
$r2 = str_replace(' ', '', $r1);
return $r2;
}
// Warm up
for($i = 0; $i < $count; $i++) {
strpos($class, 'Concrete5_Model_');
}
// Test - current
$t0 = microtime(true);
for($i = 0; $i < $count; $i++) {
camelcaseCurrent('asset_library');
}
$deltaCurrent = microtime(true) - $t0;
// Test - new
$t0 = microtime(true);
for($i = 0; $i < $count; $i++) {
camelcaseNew('asset_library');
}
$deltaNew = microtime(true) - $t0;
echo "case current: ", round($deltaCurrent * 1000, 2), " ms\n";
echo "case new: ", round($deltaNew * 1000, 2), " ms\n";
echo "new gain: ", round($deltaNew * 100 / $deltaCurrent - 100, 2), " %\n";
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.1.7 0.008 0.000 17.18 7.1.6 0.010 0.010 19.82 7.1.5 0.004 0.021 17.08 7.0.20 0.008 0.005 16.40
preferences:dark mode live preview
37.28 ms | 400 KiB | 5 Q