Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ For more detailed benchmarks and methodology, see [Go Benchmark](benchmarks/go).

For more detailed benchmarks and methodology, see [Pythonk](benchmarks/python).

### C# Serialization Performance
### JavaScript/NodeJS Serialization Performance

<p align="center">
<img src="docs/benchmarks/javascript/throughput.png" width="95%">
</p>

For more detailed benchmarks and methodology, see [JavaScript Benchmarks](docs/benchmarks/javascript).

Fory C# demonstrates excellent performance compared to protobuf-net and MessagePack-CSharp:
### C# Serialization Performance

<p align="center">
<img src="docs/benchmarks/csharp/throughput.png" width="95%">
Expand All @@ -133,7 +139,7 @@ For more detailed benchmarks and methodology, see [C# Benchmarks](docs/benchmark
<img src="docs/benchmarks/swift/throughput.png" width="95%">
</p>

For more detailed benchmarks and methodology, see [SwiftBenchmarks](docs/benchmarks/swift).
For more detailed benchmarks and methodology, see [Swift Benchmarks](docs/benchmarks/swift).

### Dart Serialization Performance

Expand Down
58 changes: 58 additions & 0 deletions benchmarks/javascript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# JavaScript Benchmark

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`](benchmarks/cpp/README.md) and uses the shared schema in [`benchmarks/proto/bench.proto`](benchmarks/proto/bench.proto).

## Coverage

- `Struct`
- `Sample`
- `MediaContent`
- `StructList`
- `SampleList`
- `MediaContentList`

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.

## Quick Start

```bash
cd benchmarks/javascript
./run.sh
```

## Run Options

```bash
./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 benchmark
```

Examples:

```bash
./run.sh --data struct
./run.sh --serializer fory
./run.sh --data sample --serializer protobuf --duration 10
```

## Generated Artifacts

Running 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`

## Notes

- The benchmark builds the JavaScript package from `javascript/` before running.
- Protobuf uses `protobufjs` with the shared `bench.proto` schema.
- JSON results use UTF-8 byte length for serialized size.
Loading
Loading