AyCode.Core/AyCode.Benchmark/Workloads/Scenarios
Loretta c611d4b535 Refactor: BDN runner, unified reporting, doc overhaul
- Introduce BDN-based runner (AcBinaryVsMemPackBenchmark) mirroring Console's FastestByte scenario; add BdnSummaryAdapter for unified result translation.
- Standardize output: both runners emit .log/.LLM/.output triplets; BDN-native artifacts go under Benchmark/BDN/.
- Simplify CLI: replace granular switches with --serializers; update help and usage.
- Remove legacy benchmark classes; focus on scenario-based approach.
- Rewrite README.md for both AyCode.Benchmark and Console to document dual-runner architecture, output conventions, and dependencies.
- Rotate BINARY_TODO.md; archive closed entries to BINARY_TODO_2026_04.md and BINARY_TODO_2026_05.md.
- Add BINARY_SGEN_OPTIMIZATION.md for SGen per-property emit optimization notes.
- Update comments and docstrings for clarity and maintainability; clarify BenchmarkResult iteration semantics for BDN rows.
2026-05-15 20:54:42 +02:00
..
AcBinaryBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryBufferWriterBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryFreshBufferWriterBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryInMemoryPipeBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryInMemoryRawByteArrayBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryNamedPipeBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
AcBinaryNamedPipeRawByteArrayBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
BenchmarkEnums.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
BenchmarkOptions.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
ISerializerBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
MemoryPackBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
MemoryPackBufferWriterBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
MemoryPackFreshBufferWriterBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
MessagePackBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
README.md Refactor: BDN runner, unified reporting, doc overhaul 2026-05-15 20:54:42 +02:00
RoundTripValidator.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00
SystemTextJsonBenchmark.cs Refactor: move benchmark engines to shared scenarios 2026-05-15 19:55:52 +02:00

README.md

Workloads / Scenarios

Shared workload + scenario types used by both the Console runner (custom adaptive measure engine) and the BDN runner (AcBinaryVsMemPackBenchmark in the parent folder). Same wire payloads, same options, same round-trip-verify gate → Console and BDN cells are directly comparable.

Layout

Contract types

  • ISerializerBenchmark.cs — common contract for every (Engine × IoMode × OptionsPreset) row. Serialize() / Deserialize() hot-path + warmup hooks + VerifyRoundTrip() for the pre-warmup correctness gate. Round-trip-only benchmarks (NamedPipe / in-memory Pipe) set IsRoundTripOnly = true and let the bench loop skip the Des-phase.
  • BenchmarkEnums.csBenchmarkEngine / BenchmarkIoMode / BenchmarkDispatchMode / BenchmarkLayer / BenchmarkOpMode / SerializerSelectionMode + ToDisplay() extensions for the column-friendly rendering used by every output formatter.
  • BenchmarkOptions.cs — per-engine options-formatting helpers + the cached AttrFlags aggregation (assembly-scan of [AcBinarySerializable] feature flags) + GetMemPack(WireMode) for the wire-mode-aligned MemoryPack-options selection.
  • RoundTripValidator.cs — universal deep-equality oracle via canonical System.Text.Json. Called by every benchmark's VerifyRoundTrip() before warmup. AOT-skipped (STJ reflection path incompatible).

Concrete benchmarks (12 implementations)

AcBinary (7 variants — different I/O modes):

MemoryPack (3 variants — apples-to-apples with the AcBinary I/O modes):

Other (reference comparison, typically disabled in active suite):

  • MessagePackBenchmark.cs — JIT-only (AOT-incompatible — v3 StandardResolver falls back to Activator.CreateInstance on trimmed closed-generic types).
  • SystemTextJsonBenchmark.cs — String I/O mode, reflection-based metadata. Far behind binary serializers on µs/op; useful as a JSON baseline when activated.

Convention

Every concrete benchmark:

  1. Stores the test data graph + serializer options in its ctor and pre-computes a _serialized byte array for SerializedSize reporting.
  2. Implements Serialize() / Deserialize() as [MethodImpl(NoInlining)] hot-paths — the bench loop drives these directly through warmup + adaptive-iter calibration + measurement.
  3. Implements VerifyRoundTrip() by calling RoundTripValidator.DeepEqualsViaJson(original, roundTripped) on the result of a single Ser+Des pass.
  4. Round-trip-only variants (NamedPipe / in-memory Pipe) override IsRoundTripOnly => true, route the full Ser+wire+Des roundtrip through Serialize(), and leave Deserialize() as a no-op.

The runner (Console BenchmarkLoop or BDN AcBinaryVsMemPackBenchmark) creates the appropriate concrete via factory helpers and drives the contract — no scenario-specific knowledge in the runner.