←back to thread

66 points chaokunyang | 3 comments | | HN request time: 0.486s | source

Serialization framework with some interesting numbers: 10-20x faster on nested objects than json/protobuf.

  Technical approach: compile-time codegen (no reflection), compact binary protocol with meta-packing, little-endian layout optimized for modern CPUs.

  Unique features that other fast serializers don't have:
  - Cross-language without IDL files (Rust ↔ Python/Java/Go)
  - Trait object serialization (Box<dyn Trait>)
  - Automatic circular reference handling
  - Schema evolution without coordination

  Happy to discuss design trade-offs.

  Benchmarks: https://fory.apache.org/docs/benchmarks/rust
1. nitwit005 ◴[] No.45738630[source]
These binary protocols generally also try to keep the data size small. Protobuf is essentially compressing its integers (varint or zigzag encoding), for example.

It'd be helpful to see a plot of serialization costs vs data size. If you only display serialization TPS, you're always going to lose to the "do nothing" option of just writing your C structs directly to the wire, which is essentially zero cost.

replies(2): >>45739175 #>>45742701 #
2. stmw ◴[] No.45739175[source]
It appears there are two schema compatibility modes and no guarantee of minor version binary compatibility.
3. chaokunyang ◴[] No.45742701[source]
Fory also compress integers using varint or zigzag encoding. The size are basically same:

| data type | data size | fory | protobuf |

| --------------- | --------- | ------- | -------- |

| simple-struct | small | 21 | 19 |

| simple-struct | medium | 70 | 66 |

| simple-struct | large | 220 | 216 |

| simple-list | small | 36 | 16 |

| simple-list | medium | 802 | 543 |

| simple-list | large | 14512 | 12876 |

| simple-map | small | 33 | 36 |

| simple-map | medium | 795 | 1182 |

| simple-map | large | 17893 | 21746 |

| person | small | 122 | 118 |

| person | medium | 873 | 948 |

| person | large | 7531 | 7865 |

| company | small | 191 | 182 |

| company | medium | 9118 | 9950 |

| company | large | 748105 | 782485 |

| e-commerce-data | small | 750 | 737 |

| e-commerce-data | medium | 53275 | 58025 |

| e-commerce-data | large | 1079358 | 1166878 |

| system-data | small | 311 | 315 |

| system-data | medium | 24301 | 26161 |

| system-data | large | 450031 | 479988 |