Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-06-24 01:41:59 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-06-24 01:41:59 +0400
commitc63131310057c6d46bcbb4605da0ad7a5050c920 (patch)
tree1227f6e3ffa4eb6f660f6e3126550fd47f7352c8 /core/AssetManager
parentbc31046e9c068b587cc0f3210126b345c8e3f8c6 (diff)
on my server (i7) this improves the loading time by another 500-800ms
Diffstat (limited to 'core/AssetManager')
-rw-r--r--core/AssetManager/UIAssetCatalog.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/AssetManager/UIAssetCatalog.php b/core/AssetManager/UIAssetCatalog.php
index 8c7ba10e3b..d8a45f8964 100644
--- a/core/AssetManager/UIAssetCatalog.php
+++ b/core/AssetManager/UIAssetCatalog.php
@@ -21,6 +21,11 @@ class UIAssetCatalog
private $catalogSorter;
/**
+ * @var string[] Absolute file locations
+ */
+ private $existingAssetLocations = array();
+
+ /**
* @param UIAssetCatalogSorter $catalogSorter
*/
function __construct($catalogSorter)
@@ -33,8 +38,10 @@ class UIAssetCatalog
*/
public function addUIAsset($uiAsset)
{
- if(!$this->assetAlreadyInCatalog($uiAsset)) {
+ $location = $uiAsset->getAbsoluteLocation();
+ if(!$this->assetAlreadyInCatalog($location)) {
+ $this->existingAssetLocations[] = $location;
$this->uiAssets[] = $uiAsset;
}
}
@@ -59,12 +66,8 @@ class UIAssetCatalog
* @param UIAsset $uiAsset
* @return boolean
*/
- private function assetAlreadyInCatalog($uiAsset)
+ private function assetAlreadyInCatalog($location)
{
- foreach($this->uiAssets as $existingAsset)
- if($uiAsset->getAbsoluteLocation() == $existingAsset->getAbsoluteLocation())
- return true;
-
- return false;
+ return in_array($location, $this->existingAssetLocations);
}
}