Pike v8.0 release 1738

Method Array.greedy_diff()


Method greedy_diff

array(array(array)) greedy_diff(array from, array to)

Description

Like Array.diff, but tries to generate bigger continuous chunks of the differences, instead of maximizing the number of difference chunks. More specifically, greedy_diff optimizes the cases where Array.diff returns ({ ..., A, Z, B, ({}), C, ... }) ({ ..., A, X, B,  Y+B, C, ... }) into the somewhat shorter diff arrays ({ ..., A, Z,     B+C, ... }) ({ ..., A, X+B+Y, B+C, ... })