This benchmark compares serialization and deserialization throughput in JavaScript for Apache Fory, Protocol Buffers, and JSON.
It mirrors the benchmark layout used by benchmarks/cpp and uses the shared schema in benchmarks/proto/bench.proto.
StructSampleMediaContentStructListSampleListMediaContentList
For Fory, all struct schemas use explicit type IDs and field IDs so compatible-mode type metadata stays compact. The numeric type IDs match the C++ benchmark registration order.
cd benchmarks/javascript
./run.sh./run.sh --help
Options:
--data <struct|sample|mediacontent|structlist|samplelist|mediacontentlist>
Filter benchmark by data type
--serializer <fory|protobuf|json>
Filter benchmark by serializer
--duration <seconds> Minimum time to run each benchmarkExamples:
./run.sh --data struct
./run.sh --serializer fory
./run.sh --data sample --serializer protobuf --duration 10Running the pipeline writes:
- raw benchmark JSON to
benchmarks/javascript/benchmark_results.json - plots to
docs/benchmarks/javascript/*.png - Markdown report to
docs/benchmarks/javascript/README.md
- The benchmark builds the JavaScript package from
javascript/before running. - Protobuf uses
protobufjswith the sharedbench.protoschema. - JSON results use UTF-8 byte length for serialized size.