NOSSLETTER.techLIVE
back to archive

[Flight] Outline and dedupe repeated strings

Language: JavaScript+505 -12performance
The Issue & Context

React Flight serializes strings in import metadata either by inlining small strings or outlining large strings (>=1024 chars), but neither method deduplicates repeated strings. This causes redundant transmission of identical strings, notably bundler chunk URLs repeated across multiple client references, increasing payload size.

Root Cause Analysis

The lack of deduplication for strings in import metadata leads to repeated transmission of the same strings multiple times, inflating the data sent over the wire, especially since chunk names are commonly shared across many client modules.

Solution Strategy & Architectural Pattern

Introduced a deduplication map for strings in import metadata with a low threshold of 16 characters. Each unique string is emitted once as a separate row, and subsequent occurrences reference that row. This ensures strings are sent once and referenced thereafter, reducing redundant data. The client resolves these references without protocol changes, maintaining queue ordering to ensure string rows arrive before dependent metadata.

Key Takeaway for Contributors

Deduplicating repeated strings in import metadata significantly reduces payload size when many client references share chunk strings, improving network efficiency. The approach balances overhead by outlining strings on first occurrence for repetitive metadata, while leaving model strings and debug metadata unchanged to avoid complexity.

View full digest for 2026-08-24