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 1bca14549 docs(go): add go benchmarks result (#3296)
1bca14549 is described below
commit 1bca1454938539097b4c38fab5a3355ea453193d
Author: Shawn Yang <[email protected]>
AuthorDate: Fri Feb 6 12:04:09 2026 +0800
docs(go): add go benchmarks result (#3296)
## Why?
## What does this PR do?
Add go benchmark result
<img width="3133" height="1476" alt="benchmark_combined"
src="https://github.com/user-attachments/assets/8a968f57-e08e-44b1-8b1b-f922308be58b"
/>
## Related issues
#2982
## 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 | 14 +-
benchmarks/go_benchmark/README.md | 37 ++-
benchmarks/go_benchmark/benchmark_report.py | 31 +-
benchmarks/go_benchmark/run.sh | 11 +-
cpp/README.md | 10 +
docs/benchmarks/go/README.md | 84 ++++++
docs/benchmarks/go/benchmark_combined.png | Bin 0 -> 193421 bytes
docs/benchmarks/go/benchmark_mediacontent.png | Bin 0 -> 63179 bytes
docs/benchmarks/go/benchmark_mediacontentlist.png | Bin 0 -> 75245 bytes
docs/benchmarks/go/benchmark_results.txt | 326 ++++++++++++++++++++++
docs/benchmarks/go/benchmark_sample.png | Bin 0 -> 64836 bytes
docs/benchmarks/go/benchmark_samplelist.png | Bin 0 -> 70519 bytes
docs/benchmarks/go/benchmark_struct.png | Bin 0 -> 65532 bytes
docs/benchmarks/go/benchmark_structlist.png | Bin 0 -> 63835 bytes
docs/benchmarks/go/serialized_sizes.txt | 27 ++
go/README.md | 14 +-
16 files changed, 528 insertions(+), 26 deletions(-)
diff --git a/README.md b/README.md
index d752dfeed..4975b4c2d 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
### 🚀 High-Performance Serialization
-Apache Foryâ„¢ delivers exceptional performance through advanced optimization
techniques:
+Apache Foryâ„¢ delivers excellent performance through advanced optimization
techniques:
- **JIT Compilation**: Runtime code generation for Java eliminates virtual
method calls and inlines hot paths
- **Static Code Generation**: Compile-time code generation for Rust, C++, and
Go delivers peak performance without runtime overhead
@@ -121,7 +121,7 @@ For more detailed benchmarks and methodology, see [Rust
Benchmarks](benchmarks/r
### C++ Serialization Performance
-Fory Rust demonstrates competitive performance compared to protobuf c++
serialization framework.
+Fory C++ demonstrates competitive performance compared to protobuf c++
serialization framework.
<p align="center">
<img src="docs/benchmarks/cpp/throughput.png" width="70%">
@@ -129,6 +129,16 @@ Fory Rust demonstrates competitive performance compared to
protobuf c++ serializ
For more detailed benchmarks and methodology, see [C++
Benchmarks](benchmarks/cpp_benchmark).
+### Go Serialization Performance
+
+Fory Go demonstrates excellent performance compared to other go serialization
frameworks:
+
+<p align="center">
+<img src="docs/benchmarks/go/benchmark_combined.png" width="95%">
+</p>
+
+For more detailed benchmarks and methodology, see [Go
Benchmark](benchmarks/go_benchmark).
+
## Installation
**Java**:
diff --git a/benchmarks/go_benchmark/README.md
b/benchmarks/go_benchmark/README.md
index 8c008711e..38b0b5466 100644
--- a/benchmarks/go_benchmark/README.md
+++ b/benchmarks/go_benchmark/README.md
@@ -93,17 +93,38 @@ go test -bench=BenchmarkFory_Struct -benchmem
Example results on Apple M1 Pro:
-| Data Type | Operation | Fory (ops/s) | Protobuf (ops/s) | Msgpack
(ops/s) | Fory vs PB | Fory vs MP |
-| ------------ | ----------- | ------------ | ---------------- |
--------------- | ---------- | ---------- |
-| Struct | Serialize | 23.52M | 10.83M | 5.19M
| 2.17x | 4.54x |
-| Struct | Deserialize | 15.01M | 11.97M | 3.28M
| 1.25x | 4.58x |
-| Sample | Serialize | 8.26M | 3.01M | 750K
| 2.75x | 11.01x |
-| Sample | Deserialize | 4.52M | 2.51M | 387K
| 1.80x | 11.70x |
-| Mediacontent | Serialize | 4.93M | 2.30M | 1.17M
| 2.14x | 4.21x |
-| Mediacontent | Deserialize | 2.74M | 1.87M | 751K
| 1.46x | 3.65x |
+<p align="center">
+<img src="../../docs/benchmarks/go/benchmark_combined.png" width="95%">
+</p>
+
+| Data Type | Operation | Fory (ops/s) | Protobuf (ops/s) | Msgpack
(ops/s) | Fory vs PB | Fory vs MP |
+| ---------------- | ----------- | ------------ | ---------------- |
--------------- | ---------- | ---------- |
+| Struct | Serialize | 15.16M | 10.23M | 5.41M
| 1.48x | 2.80x |
+| Struct | Deserialize | 12.10M | 11.01M | 3.23M
| 1.10x | 3.75x |
+| Structlist | Serialize | 1.58M | 561K | 299K
| 2.82x | 5.28x |
+| Structlist | Deserialize | 1.10M | 529K | 175K
| 2.09x | 6.30x |
+| Sample | Serialize | 7.28M | 2.72M | 670K
| 2.68x | 10.87x |
+| Sample | Deserialize | 3.79M | 2.37M | 376K
| 1.60x | 10.09x |
+| Samplelist | Serialize | 510K | 141K | 38K
| 3.61x | 13.34x |
+| Samplelist | Deserialize | 236K | 107K | 19K
| 2.20x | 12.66x |
+| Mediacontent | Serialize | 3.72M | 2.12M | 1.29M
| 1.75x | 2.88x |
+| Mediacontent | Deserialize | 2.34M | 1.81M | 698K
| 1.30x | 3.35x |
+| Mediacontentlist | Serialize | 268K | 110K | 72K
| 2.44x | 3.72x |
+| Mediacontentlist | Deserialize | 138K | 87K | 36K
| 1.58x | 3.86x |
_Note: Results vary by hardware. Run benchmarks on your own system for
accurate comparisons. List benchmarks are included in the generated report._
+## Serialized Data Sizes (bytes)
+
+| Data Type | Fory | Protobuf | Msgpack |
+| ---------------- | ---- | -------- | ------- |
+| Struct | 58 | 61 | 57 |
+| Sample | 446 | 375 | 524 |
+| MediaContent | 342 | 301 | 400 |
+| StructList | 560 | 1260 | 1146 |
+| SampleList | 7600 | 7560 | 10486 |
+| MediaContentList | 5776 | 6080 | 8006 |
+
## Benchmark Methodology
### Fair Comparison
diff --git a/benchmarks/go_benchmark/benchmark_report.py
b/benchmarks/go_benchmark/benchmark_report.py
index d00418a2b..ff7990bb0 100755
--- a/benchmarks/go_benchmark/benchmark_report.py
+++ b/benchmarks/go_benchmark/benchmark_report.py
@@ -208,22 +208,35 @@ def generate_plots(results, output_dir):
# Add speedup annotations
if "fory" in data:
fory_val = 1e9 / data["fory"]
+ speedup_lines = []
for s in available_serializers:
if s != "fory" and s in data:
other_val = 1e9 / data[s]
speedup = fory_val / other_val
if speedup > 1:
- ax.text(
- 0.5,
- 0.95,
- f"Fory {speedup:.1f}x faster",
- transform=ax.transAxes,
- ha="center",
- fontsize=10,
- color="green",
- fontweight="bold",
+ speedup_lines.append(
+ f"Fory {speedup:.1f}x faster than {s.title()}"
)
+ if speedup_lines:
+ ax.text(
+ 0.98,
+ 0.98,
+ "\n".join(speedup_lines),
+ transform=ax.transAxes,
+ ha="right",
+ va="top",
+ fontsize=9,
+ color="green",
+ fontweight="bold",
+ bbox=dict(
+ boxstyle="round,pad=0.25",
+ facecolor="white",
+ edgecolor="none",
+ alpha=0.85,
+ ),
+ )
+
plt.tight_layout()
plt.savefig(
os.path.join(output_dir, f"benchmark_{datatype}.png"),
diff --git a/benchmarks/go_benchmark/run.sh b/benchmarks/go_benchmark/run.sh
index 448da66a5..503f14e37 100755
--- a/benchmarks/go_benchmark/run.sh
+++ b/benchmarks/go_benchmark/run.sh
@@ -199,7 +199,16 @@ go test $BENCH_ARGS -benchmem -count=1
-benchtime=$BENCHTIME -json > "$OUTPUT_DI
# Print serialized sizes
echo ""
go test -run TestPrintSerializedSizes -v 2>&1 | \
- grep -A 20 "Serialized Sizes" | \
+ awk '
+ /Serialized Sizes \(bytes\):/ { capture = 1 }
+ capture { print }
+ capture && /^=+$/ {
+ separator_count++
+ if (separator_count == 2) {
+ exit
+ }
+ }
+ ' | \
tee "$OUTPUT_DIR/serialized_sizes.txt"
# Generate report
diff --git a/cpp/README.md b/cpp/README.md
index d3f4314bb..9a66b1391 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -16,6 +16,16 @@ The C++ implementation provides high-performance
serialization with compile-time
- **Two Formats**: Object graph serialization and zero-copy row-based format
- **Modern C++17**: Clean API using modern C++ features
+## Benchmark
+
+Fory C++ demonstrates competitive performance compared to protobuf c++
serialization framework.
+
+<p align="center">
+<img src="../docs/benchmarks/cpp/throughput.png" width="95%">
+</p>
+
+For more detailed benchmarks and methodology, see [C++
Benchmarks](../benchmarks/cpp_benchmark).
+
## Quick Start
### Basic Example
diff --git a/docs/benchmarks/go/README.md b/docs/benchmarks/go/README.md
new file mode 100644
index 000000000..582b053c8
--- /dev/null
+++ b/docs/benchmarks/go/README.md
@@ -0,0 +1,84 @@
+# Go Serialization Benchmark Report
+
+Generated: 2026-02-06 11:26:58
+
+## System Information
+
+- **OS**: Darwin 24.6.0
+- **Architecture**: arm64
+- **Python**: 3.10.8
+
+## Performance Summary
+
+| Data Type | Operation | Fory (ops/s) | Protobuf (ops/s) | Msgpack
(ops/s) | Fory vs PB | Fory vs MP |
+| ---------------- | ----------- | ------------ | ---------------- |
--------------- | ---------- | ---------- |
+| Struct | Serialize | 15.16M | 10.23M | 5.41M
| 1.48x | 2.80x |
+| Struct | Deserialize | 12.10M | 11.01M | 3.23M
| 1.10x | 3.75x |
+| Structlist | Serialize | 1.58M | 561K | 299K
| 2.82x | 5.28x |
+| Structlist | Deserialize | 1.10M | 529K | 175K
| 2.09x | 6.30x |
+| Sample | Serialize | 7.28M | 2.72M | 670K
| 2.68x | 10.87x |
+| Sample | Deserialize | 3.79M | 2.37M | 376K
| 1.60x | 10.09x |
+| Samplelist | Serialize | 510K | 141K | 38K
| 3.61x | 13.34x |
+| Samplelist | Deserialize | 236K | 107K | 19K
| 2.20x | 12.66x |
+| Mediacontent | Serialize | 3.72M | 2.12M | 1.29M
| 1.75x | 2.88x |
+| Mediacontent | Deserialize | 2.34M | 1.81M | 698K
| 1.30x | 3.35x |
+| Mediacontentlist | Serialize | 268K | 110K | 72K
| 2.44x | 3.72x |
+| Mediacontentlist | Deserialize | 138K | 87K | 36K
| 1.58x | 3.86x |
+
+## Detailed Timing (ns/op)
+
+| Data Type | Operation | Fory | Protobuf | Msgpack |
+| ---------------- | ----------- | ------ | -------- | ------- |
+| Struct | Serialize | 66.0 | 97.8 | 184.9 |
+| Struct | Deserialize | 82.7 | 90.9 | 309.6 |
+| Structlist | Serialize | 632.8 | 1783.0 | 3340.0 |
+| Structlist | Deserialize | 906.4 | 1891.0 | 5709.0 |
+| Sample | Serialize | 137.3 | 367.3 | 1492.0 |
+| Sample | Deserialize | 263.6 | 422.2 | 2661.0 |
+| Samplelist | Serialize | 1962.0 | 7087.0 | 26169.0 |
+| Samplelist | Deserialize | 4234.0 | 9321.0 | 53615.0 |
+| Mediacontent | Serialize | 268.8 | 471.1 | 773.7 |
+| Mediacontent | Deserialize | 426.9 | 553.1 | 1432.0 |
+| Mediacontentlist | Serialize | 3736.0 | 9107.0 | 13911.0 |
+| Mediacontentlist | Deserialize | 7247.0 | 11435.0 | 27975.0 |
+
+### Serialized Data Sizes (bytes)
+
+| Data Type | Fory | Protobuf | Msgpack |
+| ---------------- | ---- | -------- | ------- |
+| Struct | 58 | 61 | 57 |
+| Sample | 446 | 375 | 524 |
+| MediaContent | 342 | 301 | 400 |
+| StructList | 560 | 1260 | 1146 |
+| SampleList | 7600 | 7560 | 10486 |
+| MediaContentList | 5776 | 6080 | 8006 |
+
+## Performance Charts
+
+### Combined Overview
+
+
+
+### Struct
+
+
+
+### Structlist
+
+
+
+### Sample
+
+
+
+### Samplelist
+
+
+
+### Mediacontent
+
+
+
+### Mediacontentlist
+
+
diff --git a/docs/benchmarks/go/benchmark_combined.png
b/docs/benchmarks/go/benchmark_combined.png
new file mode 100644
index 000000000..fe3ede6c2
Binary files /dev/null and b/docs/benchmarks/go/benchmark_combined.png differ
diff --git a/docs/benchmarks/go/benchmark_mediacontent.png
b/docs/benchmarks/go/benchmark_mediacontent.png
new file mode 100644
index 000000000..dd914fc25
Binary files /dev/null and b/docs/benchmarks/go/benchmark_mediacontent.png
differ
diff --git a/docs/benchmarks/go/benchmark_mediacontentlist.png
b/docs/benchmarks/go/benchmark_mediacontentlist.png
new file mode 100644
index 000000000..8c10cb933
Binary files /dev/null and b/docs/benchmarks/go/benchmark_mediacontentlist.png
differ
diff --git a/docs/benchmarks/go/benchmark_results.txt
b/docs/benchmarks/go/benchmark_results.txt
new file mode 100644
index 000000000..516dc0387
--- /dev/null
+++ b/docs/benchmarks/go/benchmark_results.txt
@@ -0,0 +1,326 @@
+============================================
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
+============================================
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
+============================================
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
+============================================
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
+============================================
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
+goos: darwin
+goarch: arm64
+pkg: github.com/apache/fory/benchmarks/go_benchmark
+cpu: Apple M4 Pro
+BenchmarkFory_Struct_Serialize-12 18441836
65.29 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Struct_Serialize-12 18408471
65.41 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Struct_Serialize-12 17736544
65.19 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Struct_Serialize-12 18385110
65.37 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Struct_Serialize-12 18366690
65.95 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_Struct_Serialize-12 11775620
100.3 ns/op 144 B/op 2 allocs/op
+BenchmarkProtobuf_Struct_Serialize-12 12272547
97.80 ns/op 144 B/op 2 allocs/op
+BenchmarkProtobuf_Struct_Serialize-12 12371797
97.68 ns/op 144 B/op 2 allocs/op
+BenchmarkProtobuf_Struct_Serialize-12 12184240
97.62 ns/op 144 B/op 2 allocs/op
+BenchmarkProtobuf_Struct_Serialize-12 12216723
97.78 ns/op 144 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Serialize-12 7076667
171.4 ns/op 112 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Serialize-12 6900595
173.6 ns/op 112 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Serialize-12 6820158
184.8 ns/op 112 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Serialize-12 6626666
176.1 ns/op 112 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Serialize-12 6930025
184.9 ns/op 112 B/op 2 allocs/op
+BenchmarkFory_Struct_Deserialize-12 12602647
85.48 ns/op 32 B/op 1 allocs/op
+BenchmarkFory_Struct_Deserialize-12 14198599
82.69 ns/op 32 B/op 1 allocs/op
+BenchmarkFory_Struct_Deserialize-12 12750420
85.79 ns/op 32 B/op 1 allocs/op
+BenchmarkFory_Struct_Deserialize-12 13704170
83.80 ns/op 32 B/op 1 allocs/op
+BenchmarkFory_Struct_Deserialize-12 14302634
82.66 ns/op 32 B/op 1 allocs/op
+BenchmarkProtobuf_Struct_Deserialize-12 13726815
87.92 ns/op 80 B/op 1 allocs/op
+BenchmarkProtobuf_Struct_Deserialize-12 13350038
87.81 ns/op 80 B/op 1 allocs/op
+BenchmarkProtobuf_Struct_Deserialize-12 13771383
88.75 ns/op 80 B/op 1 allocs/op
+BenchmarkProtobuf_Struct_Deserialize-12 13840743
90.58 ns/op 80 B/op 1 allocs/op
+BenchmarkProtobuf_Struct_Deserialize-12 13009616
90.86 ns/op 80 B/op 1 allocs/op
+BenchmarkMsgpack_Struct_Deserialize-12 3796537
304.3 ns/op 80 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Deserialize-12 3963567
305.9 ns/op 80 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Deserialize-12 3949239
305.3 ns/op 80 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Deserialize-12 3842962
307.7 ns/op 80 B/op 2 allocs/op
+BenchmarkMsgpack_Struct_Deserialize-12 3946874
309.6 ns/op 80 B/op 2 allocs/op
+BenchmarkFory_StructList_Serialize-12 1887151
654.7 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_StructList_Serialize-12 1836488
635.3 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_StructList_Serialize-12 1863346
647.0 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_StructList_Serialize-12 1913204
627.8 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_StructList_Serialize-12 1887578
632.8 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_StructList_Serialize-12 664448
1773 ns/op 3104 B/op 23 allocs/op
+BenchmarkProtobuf_StructList_Serialize-12 684133
1794 ns/op 3104 B/op 23 allocs/op
+BenchmarkProtobuf_StructList_Serialize-12 642586
1784 ns/op 3104 B/op 23 allocs/op
+BenchmarkProtobuf_StructList_Serialize-12 674518
1768 ns/op 3104 B/op 23 allocs/op
+BenchmarkProtobuf_StructList_Serialize-12 668338
1783 ns/op 3104 B/op 23 allocs/op
+BenchmarkMsgpack_StructList_Serialize-12 350497
3433 ns/op 4106 B/op 8 allocs/op
+BenchmarkMsgpack_StructList_Serialize-12 351436
3409 ns/op 4106 B/op 8 allocs/op
+BenchmarkMsgpack_StructList_Serialize-12 344049
3398 ns/op 4106 B/op 8 allocs/op
+BenchmarkMsgpack_StructList_Serialize-12 357286
3361 ns/op 4106 B/op 8 allocs/op
+BenchmarkMsgpack_StructList_Serialize-12 358231
3340 ns/op 4106 B/op 8 allocs/op
+BenchmarkFory_StructList_Deserialize-12 1335152
901.9 ns/op 688 B/op 3 allocs/op
+BenchmarkFory_StructList_Deserialize-12 1295712
878.2 ns/op 688 B/op 3 allocs/op
+BenchmarkFory_StructList_Deserialize-12 1351540
889.7 ns/op 688 B/op 3 allocs/op
+BenchmarkFory_StructList_Deserialize-12 1327351
896.7 ns/op 688 B/op 3 allocs/op
+BenchmarkFory_StructList_Deserialize-12 1326216
906.4 ns/op 688 B/op 3 allocs/op
+BenchmarkProtobuf_StructList_Deserialize-12 618871
1914 ns/op 2808 B/op 28 allocs/op
+BenchmarkProtobuf_StructList_Deserialize-12 552850
1867 ns/op 2808 B/op 28 allocs/op
+BenchmarkProtobuf_StructList_Deserialize-12 621386
1887 ns/op 2808 B/op 28 allocs/op
+BenchmarkProtobuf_StructList_Deserialize-12 626301
1916 ns/op 2808 B/op 28 allocs/op
+BenchmarkProtobuf_StructList_Deserialize-12 619466
1891 ns/op 2808 B/op 28 allocs/op
+BenchmarkMsgpack_StructList_Deserialize-12 209462
5707 ns/op 1424 B/op 7 allocs/op
+BenchmarkMsgpack_StructList_Deserialize-12 205341
5680 ns/op 1424 B/op 7 allocs/op
+BenchmarkMsgpack_StructList_Deserialize-12 212827
5715 ns/op 1424 B/op 7 allocs/op
+BenchmarkMsgpack_StructList_Deserialize-12 212240
5742 ns/op 1424 B/op 7 allocs/op
+BenchmarkMsgpack_StructList_Deserialize-12 214522
5709 ns/op 1424 B/op 7 allocs/op
+BenchmarkFory_Sample_Serialize-12 8722086
137.8 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Sample_Serialize-12 8074246
137.2 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Sample_Serialize-12 8734982
137.3 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Sample_Serialize-12 8774318
137.3 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_Sample_Serialize-12 8791104
137.3 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_Sample_Serialize-12 3474804
339.3 ns/op 704 B/op 2 allocs/op
+BenchmarkProtobuf_Sample_Serialize-12 3353059
350.9 ns/op 704 B/op 2 allocs/op
+BenchmarkProtobuf_Sample_Serialize-12 3485572
359.7 ns/op 704 B/op 2 allocs/op
+BenchmarkProtobuf_Sample_Serialize-12 3293542
364.4 ns/op 704 B/op 2 allocs/op
+BenchmarkProtobuf_Sample_Serialize-12 3304266
367.3 ns/op 704 B/op 2 allocs/op
+BenchmarkMsgpack_Sample_Serialize-12 815510
1454 ns/op 2321 B/op 7 allocs/op
+BenchmarkMsgpack_Sample_Serialize-12 814988
1474 ns/op 2321 B/op 7 allocs/op
+BenchmarkMsgpack_Sample_Serialize-12 819774
1441 ns/op 2321 B/op 7 allocs/op
+BenchmarkMsgpack_Sample_Serialize-12 806146
1448 ns/op 2321 B/op 7 allocs/op
+BenchmarkMsgpack_Sample_Serialize-12 806767
1492 ns/op 2321 B/op 7 allocs/op
+BenchmarkFory_Sample_Deserialize-12 4371154
260.9 ns/op 676 B/op 9 allocs/op
+BenchmarkFory_Sample_Deserialize-12 4748262
256.2 ns/op 676 B/op 9 allocs/op
+BenchmarkFory_Sample_Deserialize-12 4563691
259.0 ns/op 676 B/op 9 allocs/op
+BenchmarkFory_Sample_Deserialize-12 4679144
257.7 ns/op 676 B/op 9 allocs/op
+BenchmarkFory_Sample_Deserialize-12 4577006
263.6 ns/op 676 B/op 9 allocs/op
+BenchmarkProtobuf_Sample_Deserialize-12 2827587
426.9 ns/op 708 B/op 9 allocs/op
+BenchmarkProtobuf_Sample_Deserialize-12 2790972
424.5 ns/op 708 B/op 9 allocs/op
+BenchmarkProtobuf_Sample_Deserialize-12 2761682
436.8 ns/op 708 B/op 9 allocs/op
+BenchmarkProtobuf_Sample_Deserialize-12 2730283
432.4 ns/op 708 B/op 9 allocs/op
+BenchmarkProtobuf_Sample_Deserialize-12 2829603
422.2 ns/op 708 B/op 9 allocs/op
+BenchmarkMsgpack_Sample_Deserialize-12 445099
2801 ns/op 1576 B/op 38 allocs/op
+BenchmarkMsgpack_Sample_Deserialize-12 437914
2686 ns/op 1576 B/op 38 allocs/op
+BenchmarkMsgpack_Sample_Deserialize-12 416235
2660 ns/op 1576 B/op 38 allocs/op
+BenchmarkMsgpack_Sample_Deserialize-12 448528
2650 ns/op 1576 B/op 38 allocs/op
+BenchmarkMsgpack_Sample_Deserialize-12 447135
2661 ns/op 1576 B/op 38 allocs/op
+BenchmarkFory_SampleList_Serialize-12 609176
1948 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_SampleList_Serialize-12 612290
1958 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_SampleList_Serialize-12 605318
1950 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_SampleList_Serialize-12 610993
1945 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_SampleList_Serialize-12 612297
1962 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_SampleList_Serialize-12 167353
6748 ns/op 14816 B/op 23 allocs/op
+BenchmarkProtobuf_SampleList_Serialize-12 170196
6906 ns/op 14816 B/op 23 allocs/op
+BenchmarkProtobuf_SampleList_Serialize-12 170259
7246 ns/op 14816 B/op 23 allocs/op
+BenchmarkProtobuf_SampleList_Serialize-12 170742
7127 ns/op 14816 B/op 23 allocs/op
+BenchmarkProtobuf_SampleList_Serialize-12 167684
7087 ns/op 14816 B/op 23 allocs/op
+BenchmarkMsgpack_SampleList_Serialize-12 46962
25632 ns/op 32793 B/op 11 allocs/op
+BenchmarkMsgpack_SampleList_Serialize-12 47451
25432 ns/op 32793 B/op 11 allocs/op
+BenchmarkMsgpack_SampleList_Serialize-12 44647
26471 ns/op 32793 B/op 11 allocs/op
+BenchmarkMsgpack_SampleList_Serialize-12 46993
25869 ns/op 32793 B/op 11 allocs/op
+BenchmarkMsgpack_SampleList_Serialize-12 46513
26169 ns/op 32792 B/op 11 allocs/op
+BenchmarkFory_SampleList_Deserialize-12 269730
4251 ns/op 13952 B/op 163 allocs/op
+BenchmarkFory_SampleList_Deserialize-12 287401
4202 ns/op 13952 B/op 163 allocs/op
+BenchmarkFory_SampleList_Deserialize-12 283461
4176 ns/op 13952 B/op 163 allocs/op
+BenchmarkFory_SampleList_Deserialize-12 278598
4257 ns/op 13952 B/op 163 allocs/op
+BenchmarkFory_SampleList_Deserialize-12 285021
4234 ns/op 13952 B/op 163 allocs/op
+BenchmarkProtobuf_SampleList_Deserialize-12 130734
9285 ns/op 20872 B/op 188 allocs/op
+BenchmarkProtobuf_SampleList_Deserialize-12 132328
9157 ns/op 20872 B/op 188 allocs/op
+BenchmarkProtobuf_SampleList_Deserialize-12 132595
9258 ns/op 20872 B/op 188 allocs/op
+BenchmarkProtobuf_SampleList_Deserialize-12 128911
9332 ns/op 20872 B/op 188 allocs/op
+BenchmarkProtobuf_SampleList_Deserialize-12 124810
9321 ns/op 20872 B/op 188 allocs/op
+BenchmarkMsgpack_SampleList_Deserialize-12 22225
53384 ns/op 37251 B/op 727 allocs/op
+BenchmarkMsgpack_SampleList_Deserialize-12 22498
54968 ns/op 37251 B/op 727 allocs/op
+BenchmarkMsgpack_SampleList_Deserialize-12 21262
54571 ns/op 37251 B/op 727 allocs/op
+BenchmarkMsgpack_SampleList_Deserialize-12 21877
54363 ns/op 37251 B/op 727 allocs/op
+BenchmarkMsgpack_SampleList_Deserialize-12 21978
53615 ns/op 37251 B/op 727 allocs/op
+BenchmarkFory_MediaContent_Serialize-12 4530111
265.7 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContent_Serialize-12 4538586
267.6 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContent_Serialize-12 4477569
264.6 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContent_Serialize-12 4504632
270.4 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContent_Serialize-12 4519728
268.8 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_MediaContent_Serialize-12 2446335
486.8 ns/op 1144 B/op 11 allocs/op
+BenchmarkProtobuf_MediaContent_Serialize-12 2468845
489.5 ns/op 1144 B/op 11 allocs/op
+BenchmarkProtobuf_MediaContent_Serialize-12 2463714
468.9 ns/op 1144 B/op 11 allocs/op
+BenchmarkProtobuf_MediaContent_Serialize-12 2605141
467.7 ns/op 1144 B/op 11 allocs/op
+BenchmarkProtobuf_MediaContent_Serialize-12 2586032
471.1 ns/op 1144 B/op 11 allocs/op
+BenchmarkMsgpack_MediaContent_Serialize-12 1496350
787.2 ns/op 1168 B/op 6 allocs/op
+BenchmarkMsgpack_MediaContent_Serialize-12 1533099
794.6 ns/op 1168 B/op 6 allocs/op
+BenchmarkMsgpack_MediaContent_Serialize-12 1533223
786.9 ns/op 1168 B/op 6 allocs/op
+BenchmarkMsgpack_MediaContent_Serialize-12 1558996
778.9 ns/op 1168 B/op 6 allocs/op
+BenchmarkMsgpack_MediaContent_Serialize-12 1535682
773.7 ns/op 1168 B/op 6 allocs/op
+BenchmarkFory_MediaContent_Deserialize-12 2840757
421.6 ns/op 656 B/op 13 allocs/op
+BenchmarkFory_MediaContent_Deserialize-12 2805544
429.2 ns/op 656 B/op 13 allocs/op
+BenchmarkFory_MediaContent_Deserialize-12 2819227
433.5 ns/op 656 B/op 13 allocs/op
+BenchmarkFory_MediaContent_Deserialize-12 2805493
426.6 ns/op 656 B/op 13 allocs/op
+BenchmarkFory_MediaContent_Deserialize-12 2828582
426.9 ns/op 656 B/op 13 allocs/op
+BenchmarkProtobuf_MediaContent_Deserialize-12 2141352
569.0 ns/op 1088 B/op 21 allocs/op
+BenchmarkProtobuf_MediaContent_Deserialize-12 2052590
559.8 ns/op 1088 B/op 21 allocs/op
+BenchmarkProtobuf_MediaContent_Deserialize-12 2134398
550.8 ns/op 1088 B/op 21 allocs/op
+BenchmarkProtobuf_MediaContent_Deserialize-12 2151742
567.4 ns/op 1088 B/op 21 allocs/op
+BenchmarkProtobuf_MediaContent_Deserialize-12 2155804
553.1 ns/op 1088 B/op 21 allocs/op
+BenchmarkMsgpack_MediaContent_Deserialize-12 838147
1376 ns/op 896 B/op 17 allocs/op
+BenchmarkMsgpack_MediaContent_Deserialize-12 824925
1392 ns/op 896 B/op 17 allocs/op
+BenchmarkMsgpack_MediaContent_Deserialize-12 814362
1414 ns/op 896 B/op 17 allocs/op
+BenchmarkMsgpack_MediaContent_Deserialize-12 837973
1399 ns/op 896 B/op 17 allocs/op
+BenchmarkMsgpack_MediaContent_Deserialize-12 850816
1432 ns/op 896 B/op 17 allocs/op
+BenchmarkFory_MediaContentList_Serialize-12 320854
3724 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContentList_Serialize-12 323788
3725 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContentList_Serialize-12 323928
3688 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContentList_Serialize-12 320772
3652 ns/op 0 B/op 0 allocs/op
+BenchmarkFory_MediaContentList_Serialize-12 325976
3736 ns/op 0 B/op 0 allocs/op
+BenchmarkProtobuf_MediaContentList_Serialize-12 128820
9015 ns/op 22848 B/op 203 allocs/op
+BenchmarkProtobuf_MediaContentList_Serialize-12 133196
9049 ns/op 22848 B/op 203 allocs/op
+BenchmarkProtobuf_MediaContentList_Serialize-12 133237
9152 ns/op 22848 B/op 203 allocs/op
+BenchmarkProtobuf_MediaContentList_Serialize-12 131954
8952 ns/op 22848 B/op 203 allocs/op
+BenchmarkProtobuf_MediaContentList_Serialize-12 132843
9107 ns/op 22848 B/op 203 allocs/op
+BenchmarkMsgpack_MediaContentList_Serialize-12 86242
13984 ns/op 16880 B/op 30 allocs/op
+BenchmarkMsgpack_MediaContentList_Serialize-12 84384
14032 ns/op 16880 B/op 30 allocs/op
+BenchmarkMsgpack_MediaContentList_Serialize-12 83804
14321 ns/op 16880 B/op 30 allocs/op
+BenchmarkMsgpack_MediaContentList_Serialize-12 87357
14185 ns/op 16880 B/op 30 allocs/op
+BenchmarkMsgpack_MediaContentList_Serialize-12 85074
13911 ns/op 16880 B/op 30 allocs/op
+BenchmarkFory_MediaContentList_Deserialize-12 158547
7564 ns/op 13040 B/op 243 allocs/op
+BenchmarkFory_MediaContentList_Deserialize-12 159993
7508 ns/op 13040 B/op 243 allocs/op
+BenchmarkFory_MediaContentList_Deserialize-12 159046
7447 ns/op 13040 B/op 243 allocs/op
+BenchmarkFory_MediaContentList_Deserialize-12 163632
7268 ns/op 13040 B/op 243 allocs/op
+BenchmarkFory_MediaContentList_Deserialize-12 163434
7247 ns/op 13040 B/op 243 allocs/op
+BenchmarkProtobuf_MediaContentList_Deserialize-12 92965
11322 ns/op 25400 B/op 428 allocs/op
+BenchmarkProtobuf_MediaContentList_Deserialize-12 105206
11297 ns/op 25400 B/op 428 allocs/op
+BenchmarkProtobuf_MediaContentList_Deserialize-12 104979
11205 ns/op 25400 B/op 428 allocs/op
+BenchmarkProtobuf_MediaContentList_Deserialize-12 105859
11327 ns/op 25400 B/op 428 allocs/op
+BenchmarkProtobuf_MediaContentList_Deserialize-12 105524
11435 ns/op 25400 B/op 428 allocs/op
+BenchmarkMsgpack_MediaContentList_Deserialize-12 43263
27244 ns/op 20058 B/op 307 allocs/op
+BenchmarkMsgpack_MediaContentList_Deserialize-12 44388
27167 ns/op 20058 B/op 307 allocs/op
+BenchmarkMsgpack_MediaContentList_Deserialize-12 44185
27271 ns/op 20058 B/op 307 allocs/op
+BenchmarkMsgpack_MediaContentList_Deserialize-12 43345
27499 ns/op 20058 B/op 307 allocs/op
+BenchmarkMsgpack_MediaContentList_Deserialize-12 43718
27975 ns/op 20058 B/op 307 allocs/op
+PASS
+ok github.com/apache/fory/benchmarks/go_benchmark 256.707s
diff --git a/docs/benchmarks/go/benchmark_sample.png
b/docs/benchmarks/go/benchmark_sample.png
new file mode 100644
index 000000000..7984bae39
Binary files /dev/null and b/docs/benchmarks/go/benchmark_sample.png differ
diff --git a/docs/benchmarks/go/benchmark_samplelist.png
b/docs/benchmarks/go/benchmark_samplelist.png
new file mode 100644
index 000000000..0f8877114
Binary files /dev/null and b/docs/benchmarks/go/benchmark_samplelist.png differ
diff --git a/docs/benchmarks/go/benchmark_struct.png
b/docs/benchmarks/go/benchmark_struct.png
new file mode 100644
index 000000000..e07c004ce
Binary files /dev/null and b/docs/benchmarks/go/benchmark_struct.png differ
diff --git a/docs/benchmarks/go/benchmark_structlist.png
b/docs/benchmarks/go/benchmark_structlist.png
new file mode 100644
index 000000000..5a97780ac
Binary files /dev/null and b/docs/benchmarks/go/benchmark_structlist.png differ
diff --git a/docs/benchmarks/go/serialized_sizes.txt
b/docs/benchmarks/go/serialized_sizes.txt
new file mode 100644
index 000000000..5a54edec6
--- /dev/null
+++ b/docs/benchmarks/go/serialized_sizes.txt
@@ -0,0 +1,27 @@
+Serialized Sizes (bytes):
+============================================
+NumericStruct:
+ Fory: 58 bytes
+ Protobuf: 61 bytes
+ Msgpack: 57 bytes
+Sample:
+ Fory: 446 bytes
+ Protobuf: 375 bytes
+ Msgpack: 524 bytes
+MediaContent:
+ Fory: 342 bytes
+ Protobuf: 301 bytes
+ Msgpack: 400 bytes
+StructList:
+ Fory: 560 bytes
+ Protobuf: 1260 bytes
+ Msgpack: 1146 bytes
+SampleList:
+ Fory: 7600 bytes
+ Protobuf: 7560 bytes
+ Msgpack: 10486 bytes
+MediaContentList:
+ Fory: 5776 bytes
+ Protobuf: 6080 bytes
+ Msgpack: 8006 bytes
+============================================
diff --git a/go/README.md b/go/README.md
index 66a986150..aa3f8d1f7 100644
--- a/go/README.md
+++ b/go/README.md
@@ -54,13 +54,15 @@ func main() {
}
```
-## How to Test
+## Benchmark
-```bash
-cd go/fory
-go test -v ./...
-go test -v fory_xlang_test.go
-```
+Fory Go demonstrates excellent performance compared to other go serialization
frameworks.
+
+<p align="center">
+<img src="../docs/benchmarks/go/benchmark_combined.png" width="95%">
+</p>
+
+For more detailed benchmarks and methodology, see [Go
Benchmark](../benchmarks/go_benchmark).
## Code Style
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]