Skip to content

Commit

Permalink
update to v1.1.2; add license file;
Browse files Browse the repository at this point in the history
  • Loading branch information
sisong committed Aug 22, 2023
1 parent 0ceb6e5 commit 2e7ec5a
Show file tree
Hide file tree
Showing 2 changed files with 229 additions and 6 deletions.
223 changes: 223 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
sfpatcher:
Copyright © 2020-2023 housisong. All rights reserved.
sfpatcher为商业软件,使用前必须获得合法授权。对外发布的可执行程序,用于小范围测试评估目的不受限制。

-----------------------------------------------------------------------------------------

HDiffPatch: https://github.com/sisong/HDiffPatch
MIT License
Copyright (c) 2012-2023 housisong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

-----------------------------------------------------------------------------------------

libdivsufsort:https://github.com/y-256/libdivsufsort
The MIT License (MIT)

Copyright (c) 2003 Yuta Mori All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

-----------------------------------------------------------------------------------------

zlib: https://github.com/madler/zlib
zlib License
(C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu

If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.

If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
the FAQ for more information on the distribution of modified source versions.

-----------------------------------------------------------------------------------------

em_inflate: https://github.com/emmanuel-marty/em_inflate
zlib License
Copyright (c) 2019 Emmanuel Marty

This software is provided 'as-is', without any express or implied warranty. In
no event will the authors be held liable for any damages arising from the use of
this software.

Permission is granted to anyone to use this software for any purpose, including
commercial applications, and to alter it and redistribute it freely, subject to
the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

-----------------------------------------------------------------------------------------

libdeflate: https://github.com/ebiggers/libdeflate
MIT License
Copyright 2016 Eric Biggers

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

-----------------------------------------------------------------------------------------

zstd: https://github.com/facebook/zstd
BSD License

For Zstandard software

Copyright (c) 2016-present, Facebook, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-----------------------------------------------------------------------------------------

lzma: https://www.7-zip.org/sdk.html
Igor Pavlov
LZMA SDK is placed in the public domain.

Anyone is free to copy, modify, publish, use, compile, sell,
or distribute the original LZMA SDK code, either in source code form or as a compiled binary,
for any purpose, commercial or non-commercial, and by any means.

-----------------------------------------------------------------------------------------

This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2019 Julian R Seward. All
rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.

3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.

4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Julian Seward, jseward@acm.org
bzip2/libbzip2 version 1.0.8 of 13 July 2019

-----------------------------------------------------------------------------------------
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sfpatcher:针对应用商店的apk增量算法
**v1.0.15 已正式上线**,为亿级手机终端用户提供更新服务,当前最新版本 v1.1.1
**v1.0.15 已正式上线**,为亿级手机终端用户提供更新服务,当前最新版本 v1.1.2
[**sfpatcher** 命令行工具下载](https://github.com/sisong/sfpatcher/releases)(支持Windows、Linux、MacOS),
[命令行使用说明](https://github.com/sisong/sfpatcher/blob/master/cmdline_doc.md)
需要商业授权(含源代码&培训),请联系作者: <housisong@hotmail.com>
Expand Down Expand Up @@ -49,16 +49,16 @@
- diff端参数可选择性丰富,对各种使用场景可以定制性的设置合适的控制参数。
- patch结果提供丰富的错误号,以利于追踪patch失败的原因,提高升级成功率。

注1:所有测试数据来源于收集的一些常用apk应用,共32个用例;并在Kirin980上测试了部分patch。(见性能测试对比数据)
注1:所有测试数据来源于收集的一些常用apk应用,共32个用例;并在ARM CPU Kirin980上测试了部分patch。(见性能测试对比数据)

## 方案主要特性对比
### **sfpatcher 和 archive-patcher**
- sfpatcher 的patch端比 archive-patcher 快很多倍(相近大小的情况下快21倍),资源占用小(O(1)),能够满足各种使用场景的要求;而 archive-patcher 还原慢,资源占用大,一般用于后台更新场景。
- sfpatcher 的patch端比 archive-patcher 快很多倍(相近补丁大小的情况下快29倍),资源占用小(O(1)),能够满足各种使用场景的要求;而 archive-patcher 还原慢,资源占用大,一般用于后台更新场景。
- sfpatcher 生成的补丁大小在很多情况下也可以比 archive-patcher 的补丁(压缩后)更小。
- sfpatcher 创建压缩后的补丁,执行patch前不需要额外步骤解压缩补丁,边patch边随时解压缩补丁数据;而 archive-patcher 创建的补丁需要额外压缩和patch前解压。
- sfpatcher 在patch时不需要对oldApk提前进行解压,边patch边随时解压用到的oldApk中的数据,可以始终保持O(1)内存占用;而 archive-patcher 需要提前将oldApk中用到的数据全部解压缩到一个临时文件里。
- sfpatcher 支持大型apk文件,包括游戏等的更新升级,patch速度快;而 archive-patcher 有最大解压总数据512M的大小限制,而且patch也很慢,某些情况下甚至patch需要几分钟。
- sfpatcher 基于C\C++,部署兼容性不受系统限制;结合JNI在安卓上使用,兼容安卓4.1到安卓13;而 archive-patcher 基于 java 并和系统环境耦合重,diff和patch时都很可能会遇到环境兼容性问题。
- sfpatcher 支持大型apk文件,包括游戏等的更新升级,patch速度快;而 archive-patcher 有解压+未压缩总数据最大512M的限制,而且patch也很慢,某些情况下甚至patch需要几分钟。
- sfpatcher 基于C\C++,部署兼容性不受系统限制;结合JNI在安卓上使用,兼容安卓4.1到安卓13;而 archive-patcher 基于 java 并和运行时系统环境耦合重,diff和patch时都很可能会遇到环境兼容性问题。
### **sfpatcher 和 ApkDiffPatch**
- sfpatcher 可用于广泛的场景,而ApkDiffPatch用于能够对apk文件进行重新签名的场景。
- sfpatcher 的patch端比 ApkDiffPatch 更快一些,多线程时内存占用也比较可控;而 ApkDiffPatch 在并行patch的时候内存占用较大。
Expand Down Expand Up @@ -134,7 +134,7 @@ sfpatcher补充测试了用ApkNormalized(ApkDiffPatch方案)处理过的apk文
# 测试结果
其中:平均压缩率=(补丁大小/新apk大小)的平均值; 单次测试的内存占用统计值为峰值私有内存;

|diff方案|平均压缩率|平均内存|平均速度|patch|平均内存|最大内存|平均速度|Kirin980|
|diff方案|平均压缩率|平均内存|平均速度|patch|平均内存|最大内存|平均速度|arm Kirin980|
|:----|----:|----:|----:|----|----:|----:|----:|----:|
|zstd --patch-from|53.18%|2199M|3.6MB/s|mem|209M|596M|609MB/s|
|**xdelta3**|**54.51%**|422MB|3.8MB/s|mem|**98MB**|**99MB**|**170MB/s**|
Expand Down

0 comments on commit 2e7ec5a

Please sign in to comment.