sisong / sfpatcher

stable & fast to patch apk archives, used by Android app store. 为安卓应用商店使用而优化的apk增量更新算法。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于sf_diff完成后的输出

LeviKing98 opened this issue · comments

你好!我使用sf_diff对两个apk进行差分,完成后获得以下输出:

oldArchive:"apkv1"
newArchive:"apkv2"
outDiff   :"patch"
  in  old  size: 119046208
  in  new  size: 122073135
  sf_diff run with patch optimize type: 3
  and run with compress plugin: "zstd"
  out diff size: 43408037
sf_diff time: 99.429 s

run patch:
  in  old  size: 119046208
  in  new  size: 122073135
  in  diff size: 43408037
  patch_archive need decoded store 97121839 bytes
    (if decoded store in memory, min need 418629 bytes)
  patch_archive need compress 930+418595 bytes to 164171 bytes

  patch with single-thread
  check patch result Byte By Byte Equal ok!
  patch time: 1.073 s

  patch with muti-thread: 16
  check patch result Byte By Byte Equal ok!
  patch time: 0.439 s

  continue patch at 1/3, with thread: 4
  check patch result Byte By Byte Equal ok!
  continue patch time: 0.555 s

  continue patch at 2/3, with thread: 1
  check patch result Byte By Byte Equal ok!
  continue patch time: 0.523 s

请问:

 patch_archive need decoded store 97121839 bytes
    (if decoded store in memory, min need 418629 bytes)
  patch_archive need compress 930+418595 bytes to 164171 bytes

 continue patch at 1/3, with thread: 4
  check patch result Byte By Byte Equal ok!
  continue patch time: 0.555 s

  continue patch at 2/3, with thread: 1
  check patch result Byte By Byte Equal ok!
  continue patch time: 0.523 s

分别是什么意思呢

patch_archive need decoded store 97121839 bytes patch时需要一共解压出97121839字节的数据。
if decoded store in memory, min need 418629 bytes 如果上面这些数据存储在内存,最小可以申请418629字节的内存作为临时存储区才够(因为可以边使用边解压,所以需要的内存可以小于总数据量,该值受diff时-lp参数控制)。
compress 930+418595 bytes to 164171 bytes patch时需要还原压缩930(快速)+418595(较慢)的数据,压缩后大小164171
continue patch ... patch时部分支持从上次的断点(比如patch时app被用户所终止)继续patch;所以测试从 1/3、2/3处开始继续patch是否正确。

好的,谢谢解答!

请问为什么有时候输出没有 compress X+X bytes to X bytes 这行呢

都为0的时候就不输出。 (后续准备去掉这个if条件,0也输出)

compress 930+418595 bytes to 164171 bytes patch时需要还原压缩930(快速)+418595(较慢)的数据,压缩后大小164171

请问还原压缩快速和较慢的数据对还原的影响大吗,sfpatcher是否提供参数进行调整呢

-o-1 就是约束,只产生能够快速还原压缩的数据; 所以patch非常快但补丁包稍大。
-o-3 就是没有约束,尽量得到更小的补丁; -o-2 就是尽量介于之间。
另外 -ln-limitNewDecodeSize 可以用来直接控制 需要压缩还原的总数据量。
建议先仔细看看 https://github.com/sisong/sfpatcher/blob/master/cmdline_doc.md

好的