5 Commits

Author SHA1 Message Date
Sophie Waldman
98b411a649 chore(linter): Fix issues flagged by updated golangci-lint version (#19206) 2025-09-15 16:58:01 -04:00
Trevor Whitney
b5462b6639 chore: remove copied loop vars (#14383) 2024-10-04 10:38:36 -06:00
Christian Haudum
f52f8ad540 chore: Clarify compression package (#14257)
This PR renames "encoding" to "codec" in the compression package to remove the cognitive dissonance.

It also removes the `Enc` prefix for codec identifiers, so that they adhere Go's best practice of naming conventions, e.g. `compression.EncGZIP` becomes `compression.GZIP` when used in a different package.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
2024-09-30 08:55:51 +02:00
Christian Haudum
cdf084fdae perf(blooms): Remove compression of .tar archived bloom blocks (#14159)
Decompression is a CPU intensive task, especially un-gzipping. The gain of compressing a tar archive of storage optimized binary blocks is neglectable (question: is it?).

In this example, the block of ~170MiB is ~3.3MiB bigger when not compressed, which is a ratio of ~2%

```bash
$ ls -las 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar   
177048 -rw-rw-r-- 1 christian christian 181293056 Sep 18 13:49 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar

$ ls -las 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar.gz
173732 -rw-rw-r-- 1 christian christian 177897689 Sep 18 13:49 2bc017f79711e12a-2bffc5dcc0e8e964_1726004114913-1726106283939-bc42f529.tar.gz

$ qalc '(181293056 - 177897689) / 1024/ 1024'
((181293056 − 177897689) / 1024) / 1024 ≈ 3.238074303

$ qalc '181293056 / 177897689'
181293056 / 177897689 ≈ 1.019086066
```

After some consideration, we decided to store the encoding of the bloom block in the `BlockRef`. This means, that the changes in this PR do not break compatibility with existing blocks compressed with gzip, although new blocks will not be compressed any more.
However, the PR adds support for different compression algorithms, such as gzip, snappy, lz4, flate, and zstd. Compression is not configurable yet.

---

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
2024-09-20 15:55:56 +02:00
Christian Haudum
963779064b chore: Move compression utilities into separate package (#14167)
Compression tooling has been part of the `chunkenc` (chunk encoding) package in the past for legacy reasons.

Since more components use this now, it's easier to keep it in a separate package. This also eliminates the confusion around "encoding", since this has been incorrectly used synonymously with "compression" in the past.

---
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Co-authored-by: Robert Fratto <robertfratto@gmail.com>
2024-09-19 16:00:18 +02:00