Wednesday, April 13, 2022

[SOLVED] What would be a good algorithm for patching binary files on linux

Issue

I am trying to reduce data transfer to my embedded linux device by creating patches for almost similar binaries. I have memory constraints on my device and hence heavy algorithms like bsdiff and bspatch are unaffordable on my target for binary sizes of around 36-60mb. I would like to know the commands that have the best algorithms for diffing and patching files that can work with minimalistic amount of memory. I am attaching output of df and free as well here.

memory details of target


Solution

Turns out that rdiff uses a slightly better algorithm in terms of memory but creates a bigger patch(delta) file than either of bsdiff or xdelta3. xdelta3 creates the smallest patchfile but uses more memory to create patch than rdiff does. So in terms of created patch size we have -- xdelta3 < bsdiff < rdiff .

And in terms of memory consumption while applying patch we have -- rdiff < xdelta3 < bsdiff

Hope it helps people optimizing network data transfer!!!



Answered By - Mukul Mehra
Answer Checked By - Mildred Charles (WPSolving Admin)