Issue Task Closed

#50318Make DiffUtility faster and much more scaleable.

Kasper Ligaard 07/23/13, 09:17 updated 10/02/18, 12:12

Description

The method DiffUtility->explodeStringIntoWords() can be made faster and able to handle much larger inputs.

The problem: When the content element you wish to see the history for is many lines long, then _History_-view becomes slower.

As an extreme example, I have a 7000 lines long content element. It has been edited several times, so in total there at some 300KB in the history_data field for the element in the sys_history table. With the current code it takes 92 seconds to display in the History view. This can be vastly improved.

The solution: Profiling the code showed that the time was spent doing thousands of array_merge(). The fix is to collect all the arrays in an array, and then call array_merge(). It cut the time of my example above down to less than 2 seconds.

DiffUtility is used by the History_-view of content elements, _Workspaces, Version and Import/Export. Basically anything that needs a visual diff.

Patch forthcoming via Gerrit for _master_-branch.

Reviews 3