A file differencing and updating system is provided that includes a file differencing
component and a file updating component. The file differencing component, or file
differencing engine, generates a difference file in a first processor-based or
computer system from an original or old version and a new version of an electronic
file. Generation of the difference files includes processing to reduce the number
of file changes introduced by code block swaps. The processing uses an alignment
algorithm, which includes a sorting algorithm, to align the code blocks of the
original version in the same order as those of the new version, thereby eliminating
the increase in the number of byte-level file differences due to code block swaps.
During the alignment operations, the block movements are dynamically recorded at
a minimum cost level and encoded for transmission to the file updating component
for use in code recovery.