Skip to content
Snippets Groups Projects
Commit 8ca3486f authored by Kasper Ligaard's avatar Kasper Ligaard Committed by Wouter Wolters
Browse files

[TASK] Make DiffUtility faster and much more scaleable.

The method DiffUtility->explodeStringIntoWords() calls array_merge()
inside a loop. The cost of constantly doing a function invocation and
merging arrays needlessly slows the method and the whole diff utility.
Moving the array merging outside the loop, the method becomes faster
and able to handle much larger input.

Change-Id: I4c2d21cff9b18392e89e316fec9dc615e715a073
Resolves: #50318
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22508
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
parent 2a8ee1dc
Branches
Tags
No related merge requests found
......@@ -197,11 +197,11 @@ class DiffUtility {
$outArray = array();
foreach ($strArr as $lineOfWords) {
$allWords = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $lineOfWords, 1);
$outArray = array_merge($outArray, $allWords);
$outArray[] = '';
$outArray[] = '';
$outArray[] = $allWords;
$outArray[] = array('');
$outArray[] = array('');
}
return $outArray;
return call_user_func_array('array_merge', $outArray);
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment