namespace AyCode.Core.Serializers.Console.Benchmarks;
///
/// Serializer engine identifier — replaces the prior Configuration.EngineXxx string constants
/// with a type-safe enum. The benchmark-result Engine column uses for
/// the human-readable form.
///
internal enum BenchmarkEngine
{
AcBinary,
MemoryPack,
#if !AYCODE_NATIVEAOT
MessagePack,
#endif
SystemTextJson,
}
///
/// I/O mode identifier — replaces the prior Configuration.IoXxx string constants. Note that
/// and share the display string "NamedPipe"
/// (they distinguish chunked-framed vs raw-byte[] semantics, but render identically in the IO column);
/// the same applies to + ("Pipe(in-mem)").
///
internal enum BenchmarkIoMode
{
ByteArray,
BufWrReuse,
BufWrNew,
String,
NamedPipe,
NamedPipeRaw,
InMemoryPipe,
InMemoryRaw,
}
///
/// Dispatch mode identifier — replaces the prior Configuration.ModeXxx string constants.
/// Describes how property access / type dispatch happens for a given benchmark row:
///
/// - — compile-time source generator path (Unsafe.As<T> direct fields, slot-array wrapper lookup).
/// - — reflection / compiled-delegate path.
/// - — SGen root with non-SGen child types reached via bridge methods (see docs/BINARY/BINARY_SGEN.md).
///
///
internal enum BenchmarkDispatchMode
{
SGen,
Runtime,
Hybrid,
}
///
/// Test-data layer filter — selects which cells participate in the run.
/// Replaces the prior string-typed layer parameter; CLI/menu callers parse user input via
/// with ignoreCase: true.
///
/// - — no filter; every test data set runs.
/// - // — preset bundles (Comprehensive ⊇ Core, Edge ⊇ Comprehensive).
/// - //// — single-cell mini-suites for tight A/B iteration loops.
///
///
internal enum BenchmarkLayer
{
All,
Core,
Comprehensive,
Edge,
Small,
Medium,
Large,
Repeated,
Deep,
}
///
/// Per-phase operation filter — selects which sides of the benchmark (Ser, Des, both) run for each
/// serializer. Round-trip-only benchmarks (NamedPipe etc.) treat alone as
/// a no-op and only run on or . Replaces the prior string-typed
/// mode/opMode parameter.
///
internal enum BenchmarkOpMode
{
All,
Serialize,
Deserialize,
}
///
/// Serializer-set selection — drives BenchmarkLoop.CreateSerializers to return one of three
/// preset bundles instead of a magic string. Replaces the prior string-typed serializerMode
/// parameter.
///
/// - — full suite minus AsyncPipe (the streaming benchmark is opt-in).
/// - — focused AcBinary FastMode Byte[] vs MemoryPack Byte[] 1:1 comparison.
/// - — streaming I/O isolation (NamedPipe + in-memory Pipe variants only).
///
///
internal enum SerializerSelectionMode
{
Standard,
FastestByte,
AsyncPipe,
}
///
/// Display-string converters for the benchmark enums. Renders enum values into the column-friendly
/// human-readable form used by the per-row console table, the .log file CSV/formatted output,
/// and the .LLM markdown table. Centralised here so every output formatter renders identically.
///
internal static class BenchmarkEnumExtensions
{
internal static string ToDisplay(this BenchmarkEngine engine) => engine switch
{
BenchmarkEngine.AcBinary => "AcBinary",
BenchmarkEngine.MemoryPack => "MemoryPack",
#if !AYCODE_NATIVEAOT
BenchmarkEngine.MessagePack => "MessagePack",
#endif
BenchmarkEngine.SystemTextJson => "System.Text.Json",
_ => throw new ArgumentOutOfRangeException(nameof(engine), engine, null),
};
internal static string ToDisplay(this BenchmarkIoMode mode) => mode switch
{
BenchmarkIoMode.ByteArray => "Byte[]",
BenchmarkIoMode.BufWrReuse => "BufWr reuse",
BenchmarkIoMode.BufWrNew => "BufWr new",
BenchmarkIoMode.String => "String",
BenchmarkIoMode.NamedPipe => "NamedPipe",
BenchmarkIoMode.NamedPipeRaw => "NamedPipe",
BenchmarkIoMode.InMemoryPipe => "Pipe(in-mem)",
BenchmarkIoMode.InMemoryRaw => "Pipe(in-mem)",
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
};
internal static string ToDisplay(this BenchmarkDispatchMode mode) => mode switch
{
BenchmarkDispatchMode.SGen => "SGen",
BenchmarkDispatchMode.Runtime => "Runtime",
BenchmarkDispatchMode.Hybrid => "Hybrid",
_ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null),
};
}