[HttpKernel] made another speed optimization
This commit is contained in:
parent
79dce161dd
commit
561a3e47b3
@ -42,19 +42,16 @@ class ClassCollectionLoader
|
||||
|
||||
$classes = array_unique($classes);
|
||||
|
||||
if ($adaptive) {
|
||||
// don't include already declared classes
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
|
||||
// the cache is different depending on which classes are already declared
|
||||
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
|
||||
}
|
||||
|
||||
$cache = $cacheDir.'/'.$name.'.php';
|
||||
|
||||
// auto-reload
|
||||
$reload = false;
|
||||
if ($autoReload) {
|
||||
if ($adaptive) {
|
||||
// don't include already declared classes
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
}
|
||||
|
||||
$metadata = $cacheDir.'/'.$name.'.meta';
|
||||
if (!file_exists($metadata) || !file_exists($cache)) {
|
||||
$reload = true;
|
||||
@ -82,6 +79,11 @@ class ClassCollectionLoader
|
||||
return;
|
||||
}
|
||||
|
||||
if ($adaptive) {
|
||||
// don't include already declared classes
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
}
|
||||
|
||||
$files = array();
|
||||
$content = '';
|
||||
foreach ($classes as $class) {
|
||||
|
@ -434,13 +434,12 @@ class ClassCollectionLoader
|
||||
}
|
||||
self::$loaded[$name] = true;
|
||||
$classes = array_unique($classes);
|
||||
if ($adaptive) {
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
$name = $name.'-'.substr(md5(implode('|', $classes)), 0, 5);
|
||||
}
|
||||
$cache = $cacheDir.'/'.$name.'.php';
|
||||
$reload = false;
|
||||
if ($autoReload) {
|
||||
if ($adaptive) {
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
}
|
||||
$metadata = $cacheDir.'/'.$name.'.meta';
|
||||
if (!file_exists($metadata) || !file_exists($cache)) {
|
||||
$reload = true;
|
||||
@ -463,6 +462,9 @@ class ClassCollectionLoader
|
||||
require_once $cache;
|
||||
return;
|
||||
}
|
||||
if ($adaptive) {
|
||||
$classes = array_diff($classes, get_declared_classes(), get_declared_interfaces());
|
||||
}
|
||||
$files = array();
|
||||
$content = '';
|
||||
foreach ($classes as $class) {
|
||||
|
Reference in New Issue
Block a user