Project

General

Profile

Actions

Bug #63745

closed

Bug #63692: Memory consumption while bulk inserting

date/datetime checks in DataHandler->checkValue_input lead to high memory use while bulk inserting

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

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
Start date:
2014-12-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

$dateTimeFormats are fetched for every input field (altough not needed) and the expensive GeneralUtility::inList-check for date,datetime-fields is executed twice:

public function checkValueForInput($res, $value, $tcaFieldConf, $table, $id, $realPid, $field = '') {
    // Handle native date/time fields
    $dateTimeFormats = $GLOBALS['TYPO3_DB']->getDateTimeFormats($table);
    if (isset($tcaFieldConf['dbType']) && GeneralUtility::inList('date,datetime', $tcaFieldConf['dbType'])) {
        // Convert the date/time into a timestamp for the sake of the checks
        $emptyValue = $dateTimeFormats[$tcaFieldConf['dbType']]['empty'];
        $format = $dateTimeFormats[$tcaFieldConf['dbType']]['format'];
        // At this point in the processing, the timestamps are still based on UTC
        $timeZone = new \DateTimeZone('UTC');
        $dateTime = \DateTime::createFromFormat('!' . $format, $value, $timeZone);
        $value = $value === $emptyValue ? 0 : $dateTime->getTimestamp();
    }

    [...]

    // Handle native date/time fields
    if (isset($tcaFieldConf['dbType']) && GeneralUtility::inList('date,datetime', $tcaFieldConf['dbType'])) {
        // Convert the timestamp back to a date/time
        $emptyValue = $dateTimeFormats[$tcaFieldConf['dbType']]['empty'];
        $format = $dateTimeFormats[$tcaFieldConf['dbType']]['format'];
        $res['value'] = $res['value'] ? date($format, $res['value']) : $emptyValue;
    }
Actions

Also available in: Atom PDF