IPE data compression
Compression of IPE data is one potential route to decreasing the size of -finfo-table-map
enabled binaries.
- Adds an
--enable-ipe-data-compression
flag to the configure script which exposes a supposedly installedzstd
compression library to the compiler and RTS. - Restructures the IPE buffer node data layout to separate info table references from IPE data. We want to compress the IPE data, but not the info table references since those need to be translated to memory addresses during linking.
- Adds the necessary compression/decompression logic to IPE data emission section of the compiler and the IPE data loading in the RTS.
I tested the impact of this feature on binary size by compiling GHC itself and then measuring the size of the build results using the following command:
du -hc _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-*.so
For a default
GHC build (no IPE data), that command output the following:
102M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-9.7-ghc9.7.20230207.so
332K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-bignum-1.3-ghc9.7.20230207.so
836K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-9.7-ghc9.7.20230207.so
1.4M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-th-9.7-ghc9.7.20230207.so
44K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-compact-0.1.0.0-ghc9.7.20230207.so
768K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-heap-9.7-ghc9.7.20230207.so
4.8M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-prim-0.10.0-ghc9.7.20230207.so
110M total
For a default+ipe
GHC build (without IPE data compression):
243M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-9.7-ghc9.7.20230207.so
644K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-bignum-1.3-ghc9.7.20230207.so
1.7M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-9.7-ghc9.7.20230207.so
1.8M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-th-9.7-ghc9.7.20230207.so
88K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-compact-0.1.0.0-ghc9.7.20230207.so
1.8M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-heap-9.7-ghc9.7.20230207.so
14M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-prim-0.10.0-ghc9.7.20230207.so
263M total
For a default+ipe
GHC build (with IPE data compression by configuring with --enable-ipe-data-compression
):
191M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-9.7-ghc9.7.20230207.so
524K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-bignum-1.3-ghc9.7.20230207.so
1.3M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-9.7-ghc9.7.20230207.so
1.7M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-boot-th-9.7-ghc9.7.20230207.so
72K _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-compact-0.1.0.0-ghc9.7.20230207.so
1.4M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-heap-9.7-ghc9.7.20230207.so
9.2M _build/stage1/lib/x86_64-linux-ghc-9.7.20230207/libHSghc-prim-0.10.0-ghc9.7.20230207.so
205M total
Thus I conclude that the compression shrinks build results by about 20%.
Edited by Finley McIlwaine