Escaping the Fork: How Meta Modernized WebRTC Across 50+ Use Cases
Meta escaped a long-diverged internal WebRTC fork by statically linking two WebRTC versions into one binary behind a version-agnostic shim layer, which let it A/B test legacy and upstream stacks app-by-app across 50+ use cases. One Definition Rule collisions were resolved by automatically renamespacing every symbol (webrtc_legacy::, webrtc_latest::), sharing modules like rtc_base, and using bulk using-declarations for backward compatibility. Template-based flavor dispatch and AST-generated adapters handled runtime switching, and shimming at the lowest layer added ~5 MB instead of ~38 MB. Patches now live as per-release feature branches in a separate Git repo that are merged forward on each Chromium release, keeping Meta current from M120 to M145 with up to 10% lower CPU, up to 3% fewer crashes and 100-200 KB smaller binaries.
Related posts
- Rust at Scale: An Added Layer of Security for WhatsApp
Meta Engineering easyNoviceWhatsApp rewrote its cross-platform media consistency library, wamedia, from C++ to Rust and now ships it to billions of devices and browsers across Android, iOS, Mac, Web and wearables, which Meta calls the largest client-side Rust deployment it knows of. The library began after the 2015 Stagefright bug as a way to reject non-conformant MP4 files before vulnerable OS parsers saw them. It now underpins "Kaleidoscope," a set of checks for malformed structures, risky PDF features, spoofed file types and executables. The Rust version was built in parallel and validated with differential fuzzing. It replaced 160,000 lines of C++ with 90,000 lines of Rust and improved performance and memory use, with binary size and multi-platform build support as the main hurdles.
- Bun v1.1.39
Bun mediumAdept
Bun v1.1.39 introduces bun.lock, a human-readable text lockfile that improves git diffs and works with tools like Dependabot and Renovate, and makes cached bun install 30% faster. It adds streaming fetch() request bodies (chunked transfer encoding, or Content-Length when the size is known) and a zero-copy native onBeforeParse plugin API for Bun.build(), written in Rust via napi.rs, that runs in Bun's threadpool. Other changes include inline snapshot tests in bun:test, heap snapshots that count native memory, a 15% peak-RSS reduction for churned WebSocket server connections, full Node test-suite parity for string_decoder, punycode and querystring, and a WebKit upgrade bringing Error.isError and a 44% faster String.prototype.at.
- What We Learned Migrating From Webpack to Vite
Neon mediumAdept
Neon moved its console, a set of SPAs whose HTML is rendered by a Go backend, from webpack to Vite. Because the backend generates the HTML, they built a ~150-line custom proxy on Vite's JS API and http-proxy that swaps production asset tags (marked with HTML comments) for Vite dev imports to enable HMR, while E2E tests bypass the proxy and use production bundles. Build time did not improve (20s to 22s) and cold dev page loads got slower (~1500 files), but the migration removed 17 direct dependencies, added HMR and unified config with Vitest and Storybook. Gotchas included the SWC React plugin panicking on syntax errors, CSS preload errors in production, entry-point name clashes with API routes, CSP adjustments for Vite's WebSocket and undefined process.env.
- Optimizing Our Build Times by Migrating from Webpack to Rspack
Yelp Engineering mediumAdeptYelp moved its JavaScript monorepo builds from Webpack to Rspack and cut integration build time by about 52% on average. Rspack was chosen over Vite because it is compatible with Webpack config. The team built an adapter that copies the existing Webpack config and swaps in Rspack-compatible plugins and values, then rolled it out in stages with per-page opt-in on CI and deployment previews. The switch alone gave about a 25% speedup on SSR builds. Codemods replacing star re-exports and import-then-export patterns with named true re-exports added more gains, and Rspack's portable persistent cache cut warm CI builds by up to 80%.
- Build faster with Buck2: Our open source build system
Meta Engineering mediumAdeptBuck2 is Meta's from-scratch rewrite of Buck, open sourced with a Rust core and all language rules written in Starlark, and it completes builds about twice as fast as Buck1 internally. Its speed comes from a single incremental dependency graph held by a persistent daemon instead of separate target/action graph phases, plus Bazel-compatible remote execution and integration with virtual file systems via Watchman and Sapling. New rule primitives make complex patterns safe and efficient: dynamic_output lets rules run tools like ocamldep and wire dependencies from their output, and transitive-sets (tsets) avoid O(n²) memory for C++ link closures. The open source release is nearly identical to Meta's internal version and is aimed mainly at moderately sized multi-language projects.