Actions
Bug #63669
closedBug #63692: Memory consumption while bulk inserting
High memory consumption in DatabaseConnection->getDateTimeFormats while bulk inserting
Start date:
2014-12-08
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:
Description
Multiple calls from
- sysext/backend/Classes/Form/DataPreprocessor.php
- sysext/backend/Classes/Utility/BackendUtility.php
- sysext/core/Classes/DataHandling/DataHandler.php
do
$dateTimeFormats = $GLOBALS['TYPO3_DB']->getDateTimeFormats($table);
Currently there is no table handling implemented, but for EACH CALL of every field of every record to insert a new array is generated:
public function getDateTimeFormats($table) { return array( 'date' => array( 'empty' => '0000-00-00', 'format' => 'Y-m-d' ), 'datetime' => array( 'empty' => '0000-00-00 00:00:00', 'format' => 'Y-m-d H:i:s' ) ); }
Instead of creating this array multiple times it should be created as a property of the class:
/** * the date and time formats compatible with the database in general * * @var array */ protected $dateTimeFormats = array( 'date' => array( 'empty' => '0000-00-00', 'format' => 'Y-m-d' ), 'datetime' => array( 'empty' => '0000-00-00 00:00:00', 'format' => 'Y-m-d H:i:s' ) ); public function getDateTimeFormats($table) { return $this->dateTimeFormats; }
For bulk insert of 6500 records:
- memory usage of getDateTimeFormats() down from 79MB to 2kB
Actions