Bun v1.2.21 introduces a zero-copy optimization for postMessage(string) that achieves up to 500x faster performance and 22x less memory usage by avoiding serialization for thread-safe strings. The optimization works by directly sharing immutable string pointers between threads in JavaScriptCore, bypassing the Structured Clone Algorithm for strings that aren't atoms, substrings, or rope strings. This dramatically improves performance for common patterns like sending JSON between workers, with the optimization automatically applying to strings over 256 characters.

Sort: