ソースを参照

Improved Hash::get() performance

Calling Hash::get() with just one key is a very rare, since you can do $data[$key] directly. Just by adding this check it decreases the performance in about 15%.
Juan Basso 11 年 前
コミット
cc14f4bb64
1 ファイル変更1 行追加7 行削除
  1. 1 7
      src/Utility/Hash.php

+ 1 - 7
src/Utility/Hash.php

@@ -44,13 +44,7 @@ class Hash {
 			return $default;
 		}
 
-		$isString = is_string($path);
-
-		if ($isString && strpos($path, '.') === false) {
-			return isset($data[$path]) ? $data[$path] : $default;
-		}
-
-		if ($isString || is_numeric($path)) {
+		if (is_string($path) || is_numeric($path)) {
 			$parts = explode('.', $path);
 		} else {
 			if (!is_array($path)) {