<div dir="ltr"><div>Folks,</div><div><br></div><div>I'd like to get expert's opinion on which compression level is suitable for lld's -compress-debug-section=zlib option, which let the linker compress .debug_* sections using zlib.</div><div><br></div><div>Currently, lld uses compression level 9 which produces the smallest output in exchange for a longer link time. My question is, is this what people actually want? We didn't consciously choose compression level 9. That was just the default compression level for zlib::compress function.</div><div><br></div><div>For an experiment, I created a patch to use compression level 1 instead of 9 and linked clang using that modified lld. By default, lld takes 1m4s to link clang with --compress-debug-sections=zlib. With that patch, it took only 31s.</div><div><br></div><div>Here is a comparison of clang executable size with various configurations:</div><div><br></div><div><font face="monospace, monospace">no debug sections:    275 MB<br></font></div><div><font face="monospace, monospace">level 9 compression:  855 MB</font></div><div><font face="monospace, monospace">level 1 compression:  922 MB</font></div><div><font face="monospace, monospace">no compression:      2044 MB</font></div><div><br></div><div>Given that the best compression takes significantly longer time than the fastest compression, we probably should change the default to level 1. Any objections?</div><div><br></div><div>I wonder what is the best compression level when -O2 is passed to lld. We could use level 9 when -O2 is passed, but is there any reason to compress debug sections that hard in the first place?</div></div>