Project

General

Profile

Actions

Bug #63669

closed

Bug #63692: Memory consumption while bulk inserting

High memory consumption in DatabaseConnection->getDateTimeFormats while bulk inserting

Added by Stephan Großberndt about 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Performance
Target version:
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 #1

Updated by Philipp Gampe about 9 years ago

  • Parent task set to #63692
Actions #2

Updated by Gerrit Code Review about 9 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

Actions #3

Updated by Gerrit Code Review about 9 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

Actions #4

Updated by Gerrit Code Review about 9 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

Actions #5

Updated by Stephan Großberndt about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF