I am working with a (highly optimized/adapted version of) CakePHP 2.3 and my application is running on VERY slow hardware (300MHz ARM) so I am still optimizing wherever I can. One method of the framework is called VERY often and not very fast (~0.5-1ms), but I can not think of a way to improve it (without changing the output) - in total I spend ~5% of the total time in this method:
function pluginSplit($name, $dotAppend = false, $plugin = null) {
if (strpos($name, '.') !== false) {
$parts = explode('.', $name, 2);
if ($dotAppend) {
$parts[0] .= '.';
}
return $parts;
}
return array($plugin, $name);
}
Does anyone have an idea how to speed this up?
According to the profiler strpos takes about 5% of the methods time and explode ~1%:
(Profiling is about 10-15 times slower then normal execution --> 8.8ms are ~0.5-1ms without the profiler)