-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
look at contao-community-alliance/dc-general#201
we found the first bottle necks...
1.) ToolboxFile.php
core/src/MetaModels/Helper/ToolboxFile.php
Line 700 in 08b5022
| public static function convertValueToPath($varValue) |
public static function convertValueToPath($varValue)
{
+ if (empty($varValue)) {
+ return '';
+ }
$objFiles = FilesModel::findByPk($varValue);2.) with "MM-1" and attribute select to "MM-2" which also a have relation per select to "MM-3" we found a strong increase of database queries... may be, we can "cache" all existing queries
core/src/MetaModels/MetaModel.php
Line 704 in 08b5022
| public function getIdsFromFilter($objFilter, $strSortBy = '', $intOffset = 0, $intLimit = 0, $strSortOrder = 'ASC') |
...
/**
* The service container.
*
* @var IMetaModelsServiceContainer
*/
protected $serviceContainer;
+
+ private $existingIds = [];
...
public function getIdsFromFilter($objFilter, $strSortBy = '', $intOffset = 0, $intLimit = 0, $strSortOrder = 'ASC')
{
$arrFilteredIds = $this->getMatchingIds($objFilter);
// If desired, sort the entries.
if ($arrFilteredIds && $strSortBy != '') {
if ($objSortAttribute = $this->getAttribute($strSortBy)) {
$arrFilteredIds = $objSortAttribute->sortIds($arrFilteredIds, $strSortOrder);
} elseif (in_array($strSortBy, array('id', 'pid', 'tstamp', 'sorting'))) {
+ if (array_intersect($arrFilteredIds, $this->existingIds) == $arrFilteredIds) {
+ return $arrFilteredIds;
+ }
// Sort by database values.
$arrFilteredIds = $this
->getDatabase()
->prepare(
sprintf(
'SELECT id FROM %s WHERE id IN(%s) ORDER BY %s %s',
$this->getTableName(),
$this->buildDatabaseParameterList($arrFilteredIds),
$strSortBy,
$strSortOrder
)
)
->execute($arrFilteredIds)
->fetchEach('id');
+ $this->existingIds = array_merge($this->existingIds, $arrFilteredIds);
} elseif ($strSortBy == 'random') {
shuffle($arrFilteredIds);
}
}
...Metadata
Metadata
Assignees
Labels
bugA bug! A bug! Fast, squish it!A bug! A bug! Fast, squish it!