Protobuf-ES v2.14 serializes messages up to 5x faster and parses up to 2x faster for both binary and JSON wire formats, all while achieving 5% smaller bundles. There are no new APIs and nothing to configure.
The numbers
v2.14 is a performance release: nearly every change in it is an optimization to serialization or parsing. The release benchmarks compare v2.14 to v2.13 in Node across message shapes ranging from single scalars to fixtures modeled on real-world schemas:
toBinaryis up to 5x fasterfromBinaryis up to 2x fastertoJsonis up to 3x fasterfromJsonis up to 2x faster
Every operation got faster on every shape, with binary serialization seeing the largest gains. The full breakdown is in the release notes.
With speedups this large, we expected bundle size to get worse. Optimization usually means more code, since every fast path and special case adds bytes to the bundle. Instead, v2.14 generates 5% smaller bundles. A browser bundle with the library and the generated code for a small schema is under 19 KB gzipped, and because Protobuf-ES generates a compact descriptor for each message instead of per-message serialization code, the bundle grows far more slowly with schema size than generated serialization code would.
Where the speed comes from
Until now, Protobuf-ES interpreted your schema on every call: walk the field list, check the type of each field, and read or write accordingly. Interpretation keeps the library small, but it pays the same dispatch cost for every field of every message, on every call.
v2.14 does that walk once per message type. On first use, it compiles the schema into a set of per-field reader and writer functions with the type dispatch already resolved, and later calls jump straight to them.
What we didn’t trade away
The case for Protobuf-ES has always been that it gets Protobuf right: correct behavior, compatibility with the rest of your stack, an API that’s comfortable in TypeScript, and the full feature set. v2.14 adds speed on top without changing the fundamentals:
- 100% conformance. Every commit runs Google’s official conformance tests for binary, JSON, and editions. There are no test-only flags or special modes involved: the configuration that passes conformance is the configuration you install.
- JSON is still ProtoJSON.
toJsonandfromJsonspeak the spec’s canonical JSON, so a TypeScript frontend exchanges JSON with Go, Java, Python, and C++ backends without an adapter layer or a surprise about how aTimestamplooks. - The entire Protobuf feature set is still supported. Editions, extensions, custom options, reflection, and registries all work, which is what makes schema-driven tooling like Protovalidate possible on top of it. No other JavaScript Protobuf library supports Protovalidate.
- Generated code is still fully typed, in every mode.
- There is no unsafe
eval. The fastest known way to parse Protobuf in JavaScript (without blowing up bundle sizes) is to generate source code at runtime and feed it to theFunctionconstructor. Protobuf-ES doesn’t do that, in any configuration, so it runs under a strict Content-Security-Policy without asking you to addunsafe-eval.
We’ll keep working on performance, but not by trading any of the above away.
Everything built on the library gets faster too
Protobuf-ES handles serialization for Connect-ES, Connect-Query-ES, Protovalidate-ES, and other libraries across the TypeScript Protobuf ecosystem. Update it, and they all speed up with it.