---
title: "Superpack: Pushing the limits of compression in Facebook’s mobile apps"
description: "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."
url: "https://swe.quest/articles/superpack-pushing-the-limits-of-compression-in-facebook-s-mobile-apps-cb66a7a2bfc6bd02"
canonical: "https://engineering.fb.com/2021/09/13/core-infra/superpack/"
source: "Meta Engineering"
published: "2021-09-13"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 13
tags: ["compilers","algorithms","mobile","functional-programming"]
---

# Superpack: Pushing the limits of compression in Facebook’s mobile apps

A post on [Meta Engineering](https://swe.quest/sources/meta.md), published 2021-09-13, 13 min read, Deep dive. Original: [https://engineering.fb.com/2021/09/13/core-infra/superpack/](https://engineering.fb.com/2021/09/13/core-infra/superpack/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [Mobile](https://swe.quest/tags/mobile.md) (Web & mobile)
- [Functional programming](https://swe.quest/tags/functional-programming.md) (Languages)

## Prerequisites

- LZ77-family compression
- entropy coding
- compiler ASTs and register allocation
- Android APK/Dex format ([easy posts on Mobile](https://swe.quest/tags/mobile.md?difficulty=easy))

## Keywords

Superpack, Dex bytecode, Hermes, ANS, LZ parsing, SMT solver, OCaml, ARM

## Related posts

- [Introducing OpenZL: An Open Source Format-Aware Compression Framework](https://swe.quest/articles/introducing-openzl-an-open-source-format-aware-compression-framework-dcfc575219bed4e0.md): Meta Engineering · 2025-10-06 · Medium · 11 min read · Algorithms, Performance engineering, Open source, Storage systems
  OpenZL is Meta's open source lossless compression framework for structured data.
- [Speeding up LZ4 in ClickHouse](https://swe.quest/articles/speeding-up-lz4-in-clickhouse-dbbd26281ee7c0df.md): ClickHouse · 2023-04-12 · Hard · 32 min read · Performance engineering, Storage engines, C & C++, Algorithms, Analytics & OLAP
  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.
- [Five Methods For Database Obfuscation](https://swe.quest/articles/five-methods-for-database-obfuscation-477824be1d934bc1.md): ClickHouse · 2023-02-16 · Hard · 23 min read · Analytics & OLAP, Privacy, Performance engineering, Testing, Algorithms
  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.
- [Reducing Instagram’s basic video compute time by 94 percent](https://swe.quest/articles/reducing-instagram-s-basic-video-compute-time-by-94-percent-8efd07bfee25d57c.md): Meta Engineering · 2022-11-04 · Medium · 5 min read · Video & media, Cost optimization, Capacity planning, Performance engineering
  Instagram 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.
- [Accelerating our Android apps with Baseline Profiles](https://swe.quest/articles/accelerating-our-android-apps-with-baseline-profiles-5eae1308e94ba496.md): Meta Engineering · 2025-10-01 · Medium · 11 min read · Mobile, Performance engineering, Runtimes & VMs, Java & JVM, Compilers
  Meta 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
