Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 9 min read Case study mediumAdept

Language packs: Meta’s mobile localization solution

Meta delivers mobile translations as download-on-demand language packs: per-locale binary hash maps keyed by hashed string IDs, holding nested lookup tables that resolve gender and plural variations at runtime through its FBT string API. Packs are built and uploaded to cloud storage per release, then loaded from disk or downloaded during asynchronous startup, with prefetch before new versions and fallback to stale packs for poor networks. Removing bundled translations cut the Facebook iOS IPA by 16.6 MB, and packs run 600KB–2MB. Loads succeed over 99.99% of the time on iOS (~80ms from disk) and over 99.7% on Android (~780ms). Bundled packs remain preferable for apps with few strings or tight startup budgets.

Related posts

  • Building text animations for Instagram Stories

    Meta Engineering mediumAdept

    Instagram's 2020 Stories text styles and animations required solving cross-platform font delivery and Unicode-aware rendering. On Android, bundling 4.5 MB of fonts would have cost an estimated 700K installs a month, and Google's Downloadable Fonts lacked some needed fonts, so the team built a generic font repository on Everstore, their Haystack-based blob store. A month-long crash hunt during A/B testing eventually traced to that trusted caching infrastructure failing to clean up files. Character-by-character reveals had to handle ligatures, emoji, RTL text and custom spans, which led the team to drop per-character Canvas#drawText for cached StaticLayouts, while iOS word reveals used NSLinguisticTagger for language-aware tokenization.

  • Reducing Android scope-sync overhead in Sentry Flutter

    Sentry mediumAdept

    Sentry's Flutter SDK cut Android scope-update processing time by 27–30% by removing duplicate normalization and encoding JSON directly to UTF-8 bytes. Scope data was being normalized on both the calling isolate and the worker isolate, so normalizing once halved that step (e.g. 2.71 ms to 1.35 ms for 238 KB). Replacing jsonEncode plus utf8.encode plus a Uint8List copy with JsonUtf8Encoder saved 16% of encoding time, while removing the buffer copy alone saved only about 2%. Pixel 4 benchmarks show savings of about 11 µs per small breadcrumb and 2.29 ms for 238 KB payloads, and the changes ship in sentry_flutter 9.26.0.

  • How Meta brought AV1 to Reels

    Meta Engineering mediumAdept

    Meta deployed AV1 encoding and delivery for Facebook and Instagram Reels, using SVT-AV1 for encoding and the dav1d software decoder on iOS and Android because most phones lack AV1 hardware decoders. Encoding uses a two-stage hybrid ABR pipeline: a fast hardware AVC pass at upload builds a convex hull of resolution/CRF points, and videos whose projected watch time crosses a threshold get a second software encode with AVC, VP9 or AV1 at the selected points. On Android, Meta ran a small on-device benchmark to score phone capability for A/B gating, mixed hardware VP9 and software AV1 decoding for ABR lane switches, and prefetched videos to hide decoder startup latency. On iPhone, AV1 cut average Reels bit rate by 12% and raised playback FB-MOS by about 0.6 points.

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

    Meta Engineering hardMaster

    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.

  • AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms

    Hugging Face mediumAdept

    AnyLanguageModel 1.0 is a Swift package that acts as a drop-in replacement for Apple's Foundation Models framework, letting apps swap the model and provider by changing a single import. Over the past year it gained tool calling, guided generation including nested @Generable types, and image support across every provider. It covers local models via llama.cpp, MLX and Core ML as well as hosted APIs (OpenAI, Anthropic, Gemini, Ollama, Hugging Face Inference Providers, Private Cloud Compute), and reasoning blocks are omitted automatically when switching to a provider that can't replay them. API keys now come from a closure so apps can fetch short-lived tokens, the library runs on Linux, and swift-huggingface and swift-xet 1.0 ship alongside it for faster model downloads from the Hub.

The quest for software engineering knowledge.

Look:
Layout: