The GitHub Actions job "Fory CI" on fory.git/main has failed.
Run started by GitHub user chaokunyang (triggered by chaokunyang).

Head commit for run:
1cdcb42cf37d1660bf1fab56ffd1b3f72406fc9e / Shawn Yang <[email protected]>
perf(csharp): add csharp benchmarks and optimize hot serialization paths (#3396)

## Why?

- Add a first-class C# benchmark suite aligned with existing benchmark
datasets and serializers.
- Improve C# runtime hot paths while keeping benchmark comparisons fair.
- Fix enum behavior so undefined numeric enum values can round-trip
instead of failing.

## What does this PR do?

- Adds `benchmarks/csharp` benchmark harness (`Program.cs`, models,
serializer adapters, `run.sh`, and report generator) for `fory`,
`protobuf-net`, and `MessagePack`.
- Benchmarks cover `Struct`, `Sample`, `MediaContent` and list variants
for both serialize/deserialize.
- Uses directly serializable benchmark models for all three serializers
(removed protobuf conversion adapter overhead from timed path).
- Updates benchmark report generation to keep throughput and size
reporting separate, and adds a C++-style `Serialized Data Sizes (bytes)`
matrix.
- Optimizes C# runtime hot paths: reusable `ByteWriter`/`ByteReader`,
span-based string encode/decode path, and cached allowed wire-type sets.
- Improves generated/runtime schema handling: `CheckStructVersion` is
wired through contexts/generated serializers with cached no-trackRef
schema hash.
- Optimizes collection and enum hot paths: sealed collection element
types avoid redundant type-info writes; enum serializer uses cached maps
and preserves unknown numeric enum values on read.
- Simplifies config surface by removing skip-root/reflection-fallback
flags and setting default `MaxDepth` to `20`.
- Adds/updates tests for schema version behavior and undefined enum
round-trip.

## Related issues

#1017 #3387 
#3397

## Does this PR introduce any user-facing change?



- [x] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

- Command:
  - `cd benchmarks/csharp && ./run.sh --duration 3 --warmup 1`
- Selected results (ops/sec):

| Datatype         | Operation   | fory      | protobuf  | msgpack   |
| ---------------- | ----------- | ---------:| ---------:| ---------:|
| MediaContent     | Serialize   | 2,787,853 | 2,241,239 | 2,111,882 |
| MediaContent     | Deserialize | 2,601,783 | 1,343,196 | 1,252,873 |
| MediaContentList | Serialize   |   588,552 |   443,250 |   505,927 |
| MediaContentList | Deserialize |   570,945 |   289,274 |   279,718 |

- Aggregate throughput (mean ops/sec across all benchmark cases):
  - `fory`: `5,278,631`
  - `protobuf`: `2,020,540`
  - `msgpack`: `1,982,782`

Report URL: https://github.com/apache/fory/actions/runs/22336192131

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to