This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git
The following commit(s) were added to refs/heads/main by this push:
new be18fe6a8 perf: add cpp benchmark report (#3051)
be18fe6a8 is described below
commit be18fe6a877b724baaf90278710e56e39f8af36d
Author: Shawn Yang <[email protected]>
AuthorDate: Mon Dec 15 23:45:25 2025 +0800
perf: add cpp benchmark report (#3051)
## Why?
## What does this PR do?
## Related issues
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---
README.md | 10 +++++
benchmarks/cpp_benchmark/README.md | 4 ++
benchmarks/cpp_benchmark/benchmark_report.py | 2 +-
docs/benchmarks/cpp/README.md | 62 +++++++++++++++++++++++++++
docs/benchmarks/cpp/throughput.png | Bin 0 -> 52502 bytes
5 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 70d793d99..d22f76c79 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,16 @@ Fory Rust demonstrates competitive performance compared to
other Rust serializat
For more detailed benchmarks and methodology, see [Rust
Benchmarks](benchmarks/rust_benchmark).
+### C++ Serialization Performance
+
+Fory Rust demonstrates competitive performance compared to protobuf c++
serialization framework.
+
+<p align="center">
+<img src="docs/benchmarks/cpp/throughput.png" width="50%">
+</p>
+
+For more detailed benchmarks and methodology, see [C++
Benchmarks](benchmarks/cpp_benchmark).
+
## Installation
**Java**:
diff --git a/benchmarks/cpp_benchmark/README.md
b/benchmarks/cpp_benchmark/README.md
index 64e49c7aa..8f6250511 100644
--- a/benchmarks/cpp_benchmark/README.md
+++ b/benchmarks/cpp_benchmark/README.md
@@ -25,6 +25,10 @@ Note: Protobuf is fetched automatically via CMake
FetchContent, so no manual ins
### Throughput Results (ops/sec)
+<p align="center">
+<img src="../../docs/benchmarks/cpp/throughput.png" width="90%">
+</p>
+
| Datatype | Operation | Fory TPS | Protobuf TPS | Faster |
| ------------ | ----------- | ---------- | ------------ | ----------- |
| Mediacontent | Serialize | 2,312,522 | 501,867 | Fory (4.6x) |
diff --git a/benchmarks/cpp_benchmark/benchmark_report.py
b/benchmarks/cpp_benchmark/benchmark_report.py
index 884603268..08e8fb20d 100644
--- a/benchmarks/cpp_benchmark/benchmark_report.py
+++ b/benchmarks/cpp_benchmark/benchmark_report.py
@@ -233,7 +233,7 @@ for idx, op in enumerate(operations):
)
ax.set_ylabel("Throughput (ops/sec)")
- ax.set_title(f"{op.capitalize()} Throughput Comparison")
+ ax.set_title(f"{op.capitalize()} Throughput (higher is better)")
ax.set_xticks(x)
ax.set_xticklabels([dt.capitalize() for dt in datatypes])
ax.legend()
diff --git a/docs/benchmarks/cpp/README.md b/docs/benchmarks/cpp/README.md
new file mode 100644
index 000000000..ceab2eaed
--- /dev/null
+++ b/docs/benchmarks/cpp/README.md
@@ -0,0 +1,62 @@
+# C++ Benchmark Performance Report
+
+_Generated on 2025-12-15 23:03:06_
+
+## How to Generate This Report
+
+```bash
+cd benchmarks/cpp_benchmark/build
+./fory_benchmark --benchmark_format=json --benchmark_out=benchmark_results.json
+cd ..
+python benchmark_report.py --json-file build/benchmark_results.json
--output-dir report
+```
+
+## Hardware & OS Info
+
+| Key | Value |
+| -------------------------- | ------------------------- |
+| OS | Darwin 24.6.0 |
+| Machine | arm64 |
+| Processor | arm |
+| CPU Cores (Physical) | 12 |
+| CPU Cores (Logical) | 12 |
+| Total RAM (GB) | 48.0 |
+| Benchmark Date | 2025-12-15T23:02:49+08:00 |
+| CPU Cores (from benchmark) | 12 |
+
+## Benchmark Plots
+
+<p align="center">
+<img src="throughput.png" width="90%">
+</p>
+
+## Benchmark Results
+
+### Timing Results (nanoseconds)
+
+| Datatype | Operation | Fory (ns) | Protobuf (ns) | Faster |
+| ------------ | ----------- | --------- | ------------- | ----------- |
+| Mediacontent | Serialize | 435.0 | 2104.4 | Fory (4.8x) |
+| Mediacontent | Deserialize | 1361.8 | 2695.0 | Fory (2.0x) |
+| Sample | Serialize | 219.5 | 350.8 | Fory (1.6x) |
+| Sample | Deserialize | 1133.0 | 1512.6 | Fory (1.3x) |
+| Struct | Serialize | 51.2 | 184.0 | Fory (3.6x) |
+| Struct | Deserialize | 135.1 | 167.0 | Fory (1.2x) |
+
+### Throughput Results (ops/sec)
+
+| Datatype | Operation | Fory TPS | Protobuf TPS | Faster |
+| ------------ | ----------- | ---------- | ------------ | ----------- |
+| Mediacontent | Serialize | 2,298,686 | 475,190 | Fory (4.8x) |
+| Mediacontent | Deserialize | 734,318 | 371,056 | Fory (2.0x) |
+| Sample | Serialize | 4,556,001 | 2,850,266 | Fory (1.6x) |
+| Sample | Deserialize | 882,650 | 661,107 | Fory (1.3x) |
+| Struct | Serialize | 19,541,982 | 5,436,142 | Fory (3.6x) |
+| Struct | Deserialize | 7,402,696 | 5,987,231 | Fory (1.2x) |
+
+### Serialized Data Sizes (bytes)
+
+| Datatype | Fory | Protobuf |
+| -------- | ---- | -------- |
+| Struct | 34 | 61 |
+| Sample | 394 | 375 |
diff --git a/docs/benchmarks/cpp/throughput.png
b/docs/benchmarks/cpp/throughput.png
new file mode 100644
index 000000000..6d487c39a
Binary files /dev/null and b/docs/benchmarks/cpp/throughput.png differ
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]