MDL-27120: Cache dirname transformations in progressive_parser::dirname
This commit is contained in:
@@ -149,7 +149,15 @@ class progressive_parser {
|
||||
* handling parser paths, see MDL-24381
|
||||
*/
|
||||
public static function dirname($path) {
|
||||
return str_replace('\\', '/', dirname($path));
|
||||
static $cache = array();
|
||||
|
||||
if (!isset($cache[$path])) {
|
||||
if (count($cache) > 4096)
|
||||
$cache = array();
|
||||
$cache[$path] = str_replace('\\', '/', dirname($path));
|
||||
}
|
||||
|
||||
return $cache[$path];
|
||||
}
|
||||
|
||||
// Protected API starts here
|
||||
|
||||
Reference in New Issue
Block a user