Bug #63669
closedBug #63692: Memory consumption while bulk inserting
High memory consumption in DatabaseConnection->getDateTimeFormats while bulk inserting
100%
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
Updated by Gerrit Code Review almost 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35197
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35197
Updated by Gerrit Code Review almost 10 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/35427
Updated by Stephan Großberndt almost 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset c90a324afb7f4a43b601af24bfeaa1aca3e0a628.