This function is about 8 times calles for every single page call, when caching this variable I was able to gain a small performance improvement from 20,512 µs to 630 µs profiled with xhprof
Surely, this is no gigantic gain but if we would do that for every function out there...
* cache
*/
protected static $cache = array();
+ protected static $availableLanguages = array();
/**
* The best language
* @return array an array of available languages
*/
public static function findAvailableLanguages($app=null) {
+ if(!empty(self::$availableLanguages)) {
+ return self::$availableLanguages;
+ }
$available=array('en');//english is always available
$dir = self::findI18nDir($app);
if(is_dir($dir)) {
}
}
}
+
+ self::$availableLanguages = $available;
return $available;
}