[ELF] Clarify that Z_BEST_SPEED==1 in a comment. NFC

This commit is contained in:
Fangrui Song 2022-01-25 22:40:53 -08:00
parent 07bd467643
commit 2a80c3dbe1
1 changed files with 5 additions and 4 deletions

View File

@ -340,10 +340,11 @@ template <class ELFT> void OutputSection::maybeCompress() {
// Write uncompressed data to a temporary zero-initialized buffer.
auto buf = std::make_unique<uint8_t[]>(size);
writeTo<ELFT>(buf.get());
// We chose 1 as the default compression level because it is the fastest. If
// -O2 is given, we use level 6 to compress debug info more by ~15%. We found
// that level 7 to 9 doesn't make much difference (~1% more compression) while
// they take significant amount of time (~2x), so level 6 seems enough.
// We chose 1 (Z_BEST_SPEED) as the default compression level because it is
// the fastest. If -O2 is given, we use level 6 to compress debug info more by
// ~15%. We found that level 7 to 9 doesn't make much difference (~1% more
// compression) while they take significant amount of time (~2x), so level 6
// seems enough.
const int level = config->optimize >= 2 ? 6 : Z_BEST_SPEED;
// Split input into 1-MiB shards.