jlink 压缩选项有什么作用? oracle 文档对此没有详细说明:
Enable compression of resources:
0: No compression
1: Constant string sharing
2: ZIP
压缩的资源是什么? --compress=2
有什么缺点吗?
最佳答案
--compress=2 有什么缺点吗
我不知道 compress=2
是如何在内部压缩模块的,也不知道哪些模块将有针对性地压缩 pin,但我发现了这个与性能相关的错误
Performance data/impact for users to determine what jlink optimization should be selected
--strip-debug is enabled by default in the build for JRE images, and reduces size of the runtime image (lib/modules) by ~20% (130M -> 106M) with no effect on startup
--compress=0 drops the size of lib/modules by ~30% (106M -> 69.5M), and actually seems to benefit startup in simple tests (~8 ms improvement on Hello World).
--compress=1 drops the size of lib/modules by ~54% (106M -> 49M), but comes with a penalty to startup (~8ms slowdown on Hello World)
--compress=2 drops the size of lib/modules by ~53% (106M -> 49.5M), but comes with an even greater penalty to startup (~13ms slowdown on Hello World)
In my opinion the numeric level argument to --compress is counter-intuitive and should perhaps be called out explicitly instead (--compress=strings, --compress=zip). Since it appears the two different compression strategies are working against each other it seems that perhaps they should even be mutually exclusive (remove --compress=2).
--compress=0 strikes a balance between improving startup and static footprint, --compress=1 minimizes static footprint at a small penalty to startup time.
关于java - jlink 选项 compress 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55715624/