Browse Source

Bypass unnecessary foreach loop when $paths is empty to improve speed.

Yosuke Basuke Suzuki 14 years ago
parent
commit
810e2a4ffe
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lib/Cake/Core/App.php

+ 6 - 1
lib/Cake/Core/App.php

@@ -359,8 +359,13 @@ class App {
 			}
 		}
 
+		if (empty($paths)) {
+			self::$_packages = $defaults;
+			return;
+		}
+
 		foreach ($defaults as $type => $default) {
-			if (empty(self::$_packages[$type]) || empty($paths)) {
+			if (empty(self::$_packages[$type])) {
 				self::$_packages[$type] = $default;
 			}