Issue Bug Closed

#63670High memory consumption in DataHandler->checkValue_input while bulk inserting

Stephan Großberndt 12/08/14, 15:26 updated 10/02/18, 11:48

Description

In DataHandler->checkValue_input for each input value of each record to insert is executed.

// Process evaluation settings:
$evalCodesArray = GeneralUtility::trimExplode(',', $tcaFieldConf['eval'], TRUE);

While this may seem minor introducing a cache here helps:

public function checkValue_input($res, $value, $tcaFieldConf, $PP, $field = '') {
    static $evalCodesCache = array();

    [...]
    // Process evaluation settings:
    if ($evalCodesCache[$tcaFieldConf['eval']]) {
        $evalCodesArray = $evalCodesCache[$tcaFieldConf['eval']];
    } else {
        $evalCodesArray = GeneralUtility::trimExplode(',', $tcaFieldConf['eval'], TRUE);
        $evalCodesCache[$tcaFieldConf['eval']] = $evalCodesArray;
    }
For bulk inserting of 6500 records:
  • 2 calls instead of 44646 to trimExplode from this function
  • 0.7 sec faster
  • memory_usage of trimExplode down by 17MB

Reviews 3