Superpack: Pushing the limits of compression in Facebook’s mobile apps
Superpack is Meta's asymmetric compressor that combines compiler analysis with data compression, cutting Android app size by over 20% on average versus default Zip compression for apps like Facebook, Instagram, WhatsApp and Messenger. Grouping instructions by AST type yields longer LZ matches and shorter distances, with hierarchical compression folding the split/no-split decision into the optimal parse. Compiler-derived contexts such as opcodes lower the entropy of literals, and unstructured data like Dex references is turned into small register-based programs, which makes compression a register allocation problem. It targets Dex, ARM machine code and Hermes bytecode, is written in OCaml (compressor, SMT-based parsing) and C (decompressor), and trades slow compression for fast decompression, so it does not suit streaming use.
Related posts
- Introducing OpenZL: An Open Source Format-Aware Compression Framework
Meta Engineering mediumAdeptOpenZL is Meta's open source lossless compression framework for structured data. It applies a configurable graph of reversible transforms, such as array-of-structs to struct-of-arrays, delta, transpose and tokenize, to expose order before entropy coding. An offline trainer builds plans from SDDL format descriptions or parsers, and each frame embeds its resolved decode recipe, so one universal decoder handles every format and plan. On the Silesia sao file it reaches a 2.06x ratio at 340 MB/s compression and 1200 MB/s decompression, versus 1.31x for zstd -3 and 1.64x for xz -9. It falls back to zstd on unstructured text, and CSV parsing caps compression speed at about 64 MB/s.
- Speeding up LZ4 in ClickHouse
ClickHouse hardMaster
LZ4 decompression often tops ClickHouse query profiles because highly compressible, cached columnar data shifts the cost onto CPU, yet storing data uncompressed proved impractical due to disk space. LZ4 is an LZ77 variant whose compressed blocks alternate literals and matches within a 64 KB sliding window, and whose compressor finds matches through a hash-based "cache table". Decompression speeds up when generic memcpy is replaced by inlined over-copying routines such as wildCopy8, which may safely read and write extra bytes inside buffer bounds. The fast decoder skips bounds checks on match copies, so untrusted input needs checksums, guard pages or the safe decoder.
- Five Methods For Database Obfuscation
ClickHouse hardMaster
ClickHouse needed publishable benchmark data that kept the properties driving analytical query performance in its private web analytics dataset: compression ratio, per-column and cross-column cardinality, and value distributions such as power laws. The post compares approaches to obfuscating that data. Hand-written probabilistic models in C++ were too laborious and specific to one dataset. An LSTM that generated TSV dumps produced gigabyte-sized models, ran at about 100 rows per second and distorted character frequencies. Mutating the literals inside LZ4-compressed data preserved compression ratio and decompression speed while removing every original byte, guided by heuristics that keep structure such as valid UTF-8.
- Reducing Instagram’s basic video compute time by 94 percent
Meta Engineering mediumAdeptInstagram cut the compute cost of its basic adaptive bit rate (ABR) video encodings by 94 percent by reusing the frames from its progressive encodings and repackaging them into a DASH-capable file structure instead of transcoding from the original upload. Both encoding types used the same H.264 codec with only minor profile and preset differences, so repackaging with MP4Box takes about 0.36s of CPU time versus 86s for a full ffmpeg transcode. The tradeoff is worse compression efficiency for basic ABR. An A/B framework that replicated traffic across equal-capacity test and control pools showed the freed compute raised advanced-encoding watch time coverage by 33 percent, which more than made up for the loss.
- Accelerating our Android apps with Baseline Profiles
Meta Engineering mediumAdeptMeta generates Android Baseline Profiles from production class-load and method-usage data to trigger ART install-time AOT compilation and app image creation, improving startup, scroll and navigation metrics by 3% to 40% across its apps. Cloud Profiles fell short because they help only later users in a rollout, give developers no control, are skewed toward early startup (ART treats startup as done after five seconds), and work only through Google Play. Meta samples class loads through a custom ClassLoader at a very low rate, adds method-cluster telemetry, keeps entries that appear above a frequency threshold, and feeds a human-readable profile to profgen. The inclusion threshold started at 80–90% of traces to limit code-size and memory-pressure costs, since compiled code is about 10x larger than dex. It has since dropped to 20%, and profiles now hold tens of thousands of entries.