[Bridge] Improve performance for correctly written whitelist.txt
If the bridge name matches exactly, it is not necessary to perform a strtolower compare of bridges. In some situations this can lead to much faster response times (depending on the amount of bridges in whitelist.txt).
This commit is contained in:
parent
d4e867f240
commit
e2e0ced055
1 changed files with 6 additions and 0 deletions
|
@ -283,6 +283,12 @@ class Bridge {
|
|||
$name = $matches[1];
|
||||
}
|
||||
|
||||
// Improve performance for correctly written bridge names
|
||||
if(in_array($name, self::getBridgeNames())) {
|
||||
$index = array_search($name, self::getBridgeNames());
|
||||
return self::getBridgeNames()[$index];
|
||||
}
|
||||
|
||||
// The name is valid if a corresponding bridge file is found on disk
|
||||
if(in_array(strtolower($name), array_map('strtolower', self::getBridgeNames()))) {
|
||||
$index = array_search(strtolower($name), array_map('strtolower', self::getBridgeNames()));
|
||||
|
|
Loading…
Reference in a new issue