Basically we have v1.0.0-full.zip which has all of the base files in it, and we have v1.0.1-delta.zip which has all of the diff files and checksums in it.
Delta application looks like this:
unzip both packages to two temp directories
one at a time, load both the original and diff into memory and apply diff. verify checksum. write to a third temp directory
zip third temp directory into v.1.0.1-full.zip
repeat N number of times (depends how many deltas there are to apply to get the current version)
Once we've created the target package, we extract v1.0.1-full.zip into the app directory (eg. app-1.0.1).
Testing a single ~50mb package with a 3mb delta, on my rig it took 3s to extract both zip's, 5s to apply delta's, and 15s to re-zip. So 23s total to apply a single diff on an SSD.
We can speed things up significantly where N > 1 by just skipping the re-zip and re-extract step.
Where N = 1, we could use a faster diff algorithm (eg vcdiff, but it only supports dotnet core). We could also re-zip the final package with STORE instead of DEFLATE, this essentially eliminates the re-zipping cost at the expense of extra disk space.
Basically we have v1.0.0-full.zip which has all of the base files in it, and we have v1.0.1-delta.zip which has all of the diff files and checksums in it.
Delta application looks like this:
Once we've created the target package, we extract v1.0.1-full.zip into the app directory (eg. app-1.0.1).
Testing a single ~50mb package with a 3mb delta, on my rig it took 3s to extract both zip's, 5s to apply delta's, and 15s to re-zip. So 23s total to apply a single diff on an SSD.
We can speed things up significantly where N > 1 by just skipping the re-zip and re-extract step.
Where N = 1, we could use a faster diff algorithm (eg vcdiff, but it only supports dotnet core). We could also re-zip the final package with STORE instead of DEFLATE, this essentially eliminates the re-zipping cost at the expense of extra disk space.