MCPcopy Create free account
hub / github.com/apache/fory / ForySerializer

Class ForySerializer

benchmarks/csharp/BenchmarkSerializers.cs:36–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36internal sealed class ForySerializer<TWrite, TRead> : IBenchmarkSerializer<TWrite>
37{
38 private readonly ForyRuntime _writer = ForyRuntime.Builder().Compatible(true).Build();
39 private readonly ForyRuntime _reader = ForyRuntime.Builder().Compatible(true).Build();
40
41 public ForySerializer(bool schemaMismatch)
42 {
43 BenchmarkTypeRegistry.RegisterAll(_writer);
44 if (schemaMismatch)
45 {
46 BenchmarkTypeRegistry.RegisterAllV2(_reader);
47 }
48 else
49 {
50 BenchmarkTypeRegistry.RegisterAll(_reader);
51 }
52 }
53
54 public string Name => "fory";
55
56 public byte[] Serialize(TWrite value)
57 {
58 return _writer.Serialize(value);
59 }
60
61 public object? Deserialize(byte[] payload)
62 {
63 return _reader.Deserialize<TRead>(payload);
64 }
65}
66
67internal static class BenchmarkTypeRegistry
68{

Callers

nothing calls this directly

Calls 3

BuildMethod · 0.80
BuilderMethod · 0.80
CompatibleMethod · 0.45

Tested by

no test coverage detected