r/cpp • u/Shawn-Yang25 • Feb 18 '26
Apache Fory C++: Fast Serialization with Shared/Circular Reference Tracking, Polymorphism, Schema Evolutionn and up to 12x Faster Than Protobuf
We just released Apache Fory Serialization support for c++:
https://fory.apache.org/blog/fory_cpp_blazing_fast_serialization_framework
Highlights:
- Automatic idiomatic cross-language serializaton: no adapter layer, serialize in C++, deserialize in Python.
- Polymorphism via smart pointers: Fory detects
std::is_polymorphic<T>automatically. Serialize through ashared_ptr<Animal>, get a Dog back. - Circular/shared reference tracking: Shared objects are serialized once and encoded as back-references. Cycles don't overflow the stack.
- Schema evolution: Compatible mode matches fields by name/id, not position. Add fields on one side without coordinating deployments.
- IDL compiler (optional):
foryc ecommerce.fdl --cpp_out ./gengenerates idiomatic code for every language from one schema. Generated code can be used as domain objects directly - 6. Row format: O(1) random field access by index, useful for analytics workloads where you only read a few fields per record.
Throughput vs. Protobuf: up to 12x depending on workload.
GitHub: https://github.com/apache/fory
C++ docs: https://fory.apache.org/docs/guide/cpp
I’d really like critical feedback on API ergonomics, and production fit.
89
Upvotes
View all comments
Show parent comment
4
u/Shawn-Yang25 Feb 19 '26
This is exactly the limitation of zero-copy serialization frameworks such as CapnProto or Flatbuffer. You can't change message objects in place, especially for variable length fields.
With fory, you can chnage message objects in place, the message objects are just normal c++ objects, you can take it as domain objects directly.
Fory take a two pass approache, you populate/edit message objects in your system, and then fory will apply another pass to write that object into a stream. Two pass are decoupled, so you will always get your flexibility