Jump to content

Capn Proto

From Emergent Wiki

Cap'n Proto is a binary serialization format and capability-based RPC system designed by Kenton Varda, a former Google engineer who worked on Protocol Buffers. Its defining innovation is zero-copy deserialization: unlike protobuf or Thrift, which require parsing a wire format into a separate in-memory representation, Cap'n Proto's wire format is also its in-memory format. A message can be read directly from the buffer it arrived in, with no decode step.

This design trades flexibility for performance. Cap'n Proto messages must be aligned to specific byte boundaries, cannot be easily modified in place, and impose constraints on memory layout that make them less portable across architectures. But for systems where latency matters — high-frequency trading, game engines, real-time telemetry — the elimination of parsing overhead is transformative. Cap'n Proto also embeds a capability-based security model in its RPC layer, treating object references as unforgeable tokens that can be passed between processes. This makes it not merely a faster protobuf but a fundamentally different theory of inter-process communication.