Merge remote-tracking branch 'upstream/master' into v1.8

This commit is contained in:
Andrew Arnott 2019-03-15 10:55:15 -07:00
Родитель 4b448e4862 dafb2ca931
Коммит d1b32c83da
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A9B9910CDCCDA441
70 изменённых файлов: 5657 добавлений и 0 удалений

Просмотреть файл

@ -64,6 +64,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmark", "benchmark", "{51A614B0-E583-4DD2-AC7D-6A65634582E0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SerializerBenchmark", "benchmark\SerializerBenchmark\SerializerBenchmark.csproj", "{4142EA80-FEF4-44A5-8553-1AE84BEBAFED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -134,6 +138,10 @@ Global
{79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79C2B2CB-872A-4BA9-82DC-60F6DD77F940}.Release|Any CPU.Build.0 = Release|Any CPU
{4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4142EA80-FEF4-44A5-8553-1AE84BEBAFED}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -155,6 +163,7 @@ Global
{2A32A538-BA26-4D89-85D0-E4249AFA0837} = {BF4C4202-5015-4FBD-80E6-D0F36A06F700}
{10AD85DD-929D-49B8-BD43-45242C2644B7} = {86309CF6-0054-4CE3-BFD3-CA0AA7DB17BC}
{79C2B2CB-872A-4BA9-82DC-60F6DD77F940} = {19FE674A-AC94-4E7E-B24C-2285D1D04CDE}
{4142EA80-FEF4-44A5-8553-1AE84BEBAFED} = {51A614B0-E583-4DD2-AC7D-6A65634582E0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B3911209-2DBF-47F8-98F6-BBC0EDFE63DE}

Просмотреть файл

@ -0,0 +1,158 @@
using Benchmark.Serializers;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Exporters.Csv;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Benchmark
{
public class BenchmarkConfig : ManualConfig
{
public BenchmarkConfig()
{
// run quickly:)
var baseConfig = Job.ShortRun.WithIterationCount(1).WithWarmupCount(1);
// Add(baseConfig.With(Runtime.Clr).With(Jit.RyuJit).With(Platform.X64));
Add(baseConfig.With(Runtime.Core).With(Jit.RyuJit).With(Platform.X64));
Add(MarkdownExporter.GitHub);
Add(CsvExporter.Default);
Add(MemoryDiagnoser.Default);
Add(new DataSizeColumn());
this.Set(new CustomOrderer());
}
// 0.11.4 has bug of set CustomOrderer https://github.com/dotnet/BenchmarkDotNet/issues/1070
// so skip update to 0.11.4.
public class CustomOrderer : IOrderer
{
public bool SeparateLogicalGroups => false;
public IEnumerable<BenchmarkCase> GetExecutionOrder(BenchmarkCase[] benchmarksCase)
{
return benchmarksCase;
}
public string GetHighlightGroupKey(BenchmarkCase benchmarkCase)
{
return benchmarkCase.Descriptor.MethodIndex.ToString();
}
public string GetLogicalGroupKey(IConfig config, BenchmarkCase[] allBenchmarksCases, BenchmarkCase benchmarkCase)
{
return null;
}
public IEnumerable<IGrouping<string, BenchmarkCase>> GetLogicalGroupOrder(IEnumerable<IGrouping<string, BenchmarkCase>> logicalGroups)
{
return logicalGroups;
}
public IEnumerable<BenchmarkCase> GetSummaryOrder(BenchmarkCase[] benchmarksCases, Summary summary)
{
return benchmarksCases
.OrderBy(x => x.Descriptor.WorkloadMethod.Name)
.ThenBy(x => x.Parameters.Items.Select(y => y.Value).OfType<SerializerBase>().First().GetType().Name);
}
}
public class DataSizeColumn : IColumn
{
public string Id => "DataSize";
public string ColumnName => "DataSize";
public bool AlwaysShow => true;
public ColumnCategory Category => ColumnCategory.Custom;
public int PriorityInCategory => int.MaxValue;
public bool IsNumeric => true;
public UnitType UnitType => UnitType.Size;
public string Legend => null;
public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
{
return GetValue(summary, benchmarkCase, null);
}
public string GetValue(Summary summary, BenchmarkCase benchmarkCase, ISummaryStyle style)
{
var mi = benchmarkCase.Descriptor.WorkloadMethod;
if (mi.Name.Contains("Serialize"))
{
var instance = Activator.CreateInstance(mi.DeclaringType);
mi.DeclaringType.GetField("Serializer").SetValue(instance, benchmarkCase.Parameters[0].Value);
var bytes = (byte[])mi.Invoke(instance, null);
return ToHumanReadableSize(bytes.Length);
}
else
{
return "-";
}
}
public bool IsAvailable(Summary summary)
{
return true;
}
public bool IsDefault(Summary summary, BenchmarkCase benchmarkCase)
{
return false;
}
static string ToHumanReadableSize(long size)
{
return ToHumanReadableSize(new Nullable<long>(size));
}
static string ToHumanReadableSize(long? size)
{
if (size == null) return "NULL";
double bytes = size.Value;
if (bytes <= 1024) return bytes.ToString("f2") + " B";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " KB";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " MB";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " GB";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " TB";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " PB";
bytes = bytes / 1024;
if (bytes <= 1024) return bytes.ToString("f2") + " EB";
bytes = bytes / 1024;
return bytes + " ZB";
}
}
}
}

Просмотреть файл

@ -0,0 +1,142 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Benchmark
{
public class GenericEqualityComparer<T> : IEqualityComparer<T> where T : class, IGenericEquality<T>
{
public static readonly GenericEqualityComparer<T> Default = new GenericEqualityComparer<T>();
public bool Equals(T x, T y)
{
return x.TrueEquals(y);
}
public int GetHashCode(T obj)
{
return 0; // not fast, but not really important here
}
}
public static class ExtensionMethods
{
public static bool TrueEqualsString(this IEnumerable<string> a, IEnumerable<string> b)
{
return a.SequenceEqual(b);
}
public static bool TrueEqualsString(this string a, string b)
{
return a == b;
}
public static bool TrueEquals<T>(this T? a, T? b)
where T : struct
{
if (!a.HasValue && !b.HasValue)
{
return true;
}
if (!a.HasValue)
{
return false;
}
if (!b.HasValue)
{
return false;
}
return a.Value.Equals(b.Value);
}
public static bool TrueEquals<T>(this T a, T b)
where T : class, IGenericEquality<T>
{
if (ReferenceEquals(a, null) && ReferenceEquals(b, null))
{
return true;
}
if (ReferenceEquals(a, null))
{
return false;
}
if (ReferenceEquals(b, null))
{
return false;
}
return a.Equals(b);
}
public static bool TrueEqualsList<T>(this IEnumerable<T> a, IEnumerable<T> b)
where T : class, IGenericEquality<T>
{
return a.SequenceEqual(b, GenericEqualityComparer<T>.Default);
}
public static bool TrueEqualsListDynamic<T>(this IEnumerable<T> a, IEnumerable<dynamic> b)
where T : class, IGenericEquality<T>
{
if (ReferenceEquals(a, null) && ReferenceEquals(b, null))
{
return true;
}
if (ReferenceEquals(a, null))
{
return false;
}
if (ReferenceEquals(b, null))
{
return false;
}
using (var e1 = a.GetEnumerator())
using (var e2 = b.GetEnumerator())
{
while (true)
{
var e1Next = e1.MoveNext();
var e2Next = e2.MoveNext();
if (e1Next != e2Next)
{
return false;
}
if (!e1Next && !e2Next)
{
break;
}
var c1 = e1.Current;
var c2 = e2.Current;
if (c1 == null && c2 != null)
{
return false;
}
if (c2 == null && c1 != null)
{
return false;
}
if (!c1.EqualsDynamic(c2))
{
return false;
}
}
}
return true;
}
public static bool IsTypedList(this Type type)
{
return
type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>) ||
type.GetTypeInfo().GetInterfaces().Any(i =>
i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>));
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class BooleanValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(bool);
public object Generate()
{
return _prng.Next() % 2 == 1;
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class ByteValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(byte);
public object Generate()
{
return (byte) (_prng.Next() & 0xFF);
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
using System;
namespace Benchmark.Fixture
{
public class DateTimeOffsetValueFixture : IValueFixture
{
private long _lastValue;
public Type Type { get; } = typeof(DateTimeOffset);
public object Generate()
{
_lastValue += 1000;
return DateTimeOffset.FromUnixTimeMilliseconds(_lastValue);
}
}
}

Просмотреть файл

@ -0,0 +1,18 @@
using System;
namespace Benchmark.Fixture
{
public class DateTimeValueFixture : IValueFixture
{
private long _lastValue;
private static readonly long Offset = new DateTime(1970, 1,1,0,0,0).ToFileTime();
public Type Type { get; } = typeof(DateTime);
public object Generate()
{
_lastValue += 1000;
var dt = DateTime.FromFileTime(_lastValue+Offset);
return dt;
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class DecimalValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(decimal);
public object Generate()
{
return _prng.Next() + 0.66m;
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class DoubleValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(double);
public object Generate()
{
return _prng.Next() + 0.5d;
}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
using System;
namespace Benchmark.Fixture
{
public class EnumValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
private readonly string[] _values;
public EnumValueFixture(Type type)
{
Type = type;
_values = Enum.GetNames(Type);
}
public Type Type { get; }
public object Generate()
{
return Enum.Parse(Type, _values[_prng.Next(_values.Length)]);
}
}
}

Просмотреть файл

@ -0,0 +1,243 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Benchmark.Fixture
{
public class ExpressionTreeFixture
{
private readonly ConcurrentDictionary<Type, Func<int, int, object>> _functorCache =
new ConcurrentDictionary<Type, Func<int, int, object>>();
private readonly Dictionary<Type, IValueFixture> _valueFixtures = new Dictionary<Type, IValueFixture>();
public ExpressionTreeFixture()
{
IValueFixture[] fixtures = new IValueFixture[]
{
new StringValueFixture(),
new IntValueFixture(),
new GuidValueFixture(),
new DateTimeOffsetValueFixture(),
new DateTimeValueFixture(),
new BooleanValueFixture(),
new DecimalValueFixture(),
new LongValueFixture(),
new FloatValueFixture(),
new DoubleValueFixture(),
new ByteValueFixture(),
new ShortValueFixture(),
new ByteArrayFixture(),
new SByteValueFixture(),
new UShortValueFixture(),
new UInt32ValueFixture(),
new UInt64ValueFixture(),
new CharValueFixture()
};
foreach (var item in fixtures)
{
_valueFixtures.Add(item.Type, item);
}
}
public object Create(Type type, int repeatCount = 1, int recursiveCount = 1)
{
var functor = _functorCache.GetOrAdd(type, AddFunctor);
return functor(repeatCount, recursiveCount);
}
private Func<int, int, object> AddFunctor(Type type)
{
var repeatCount = Expression.Parameter(typeof(int), "repeatCount");
var recursiveCount = Expression.Parameter(typeof(int), "recursiveCount");
var subExpressions = new List<Expression>();
var typedOutput = Expression.Variable(type, "typedOutput");
if (_valueFixtures.ContainsKey(type) || type.IsArray || type.IsTypedList()
) // they can be generated directly
{
var expression = GenerateValue(typedOutput, repeatCount, recursiveCount, type);
subExpressions.Add(expression);
}
else
{
subExpressions.Add(Expression.Assign(typedOutput, Expression.New(type)));
var typeProps = type.GetProperties();
foreach (var propertyInfo in typeProps)
{
if (!propertyInfo.CanWrite)
{
continue;
}
var propertyType = propertyInfo.PropertyType;
var isRecursion = IsRecursion(type, propertyType) || IsRecursion(propertyType, type);
var memberAccess = Expression.MakeMemberAccess(typedOutput, propertyInfo);
var expression = GenerateValue(memberAccess, repeatCount,
isRecursion ? Expression.Decrement(recursiveCount) : (Expression)recursiveCount, propertyType);
subExpressions.Add(expression);
}
}
var returnTarget = Expression.Label(typeof(object));
var returnLabel = Expression.Label(returnTarget, Expression.Convert(typedOutput, typeof(object)));
subExpressions.Add(returnLabel);
var block = Expression.Block(new[] { typedOutput }, subExpressions);
var lambda = Expression.Lambda<Func<int, int, object>>(block, repeatCount, recursiveCount);
return lambda.Compile();
}
private bool IsRecursion(Type parentType, Type type)
{
if (type == parentType)
{
return true;
}
if (parentType.IsTypedList())
{
var childType = parentType.GetGenericArguments()[0];
return IsRecursion(type, childType);
}
if (parentType.IsArray)
{
var elementType = parentType.GetElementType();
return IsRecursion(type, elementType);
}
if (Nullable.GetUnderlyingType(parentType) != null)
{
var nullableType = Nullable.GetUnderlyingType(parentType);
return IsRecursion(type, nullableType);
}
return false;
}
private Expression GenerateValue(Expression generatedValue, Expression repeatCount, Expression recursiveCount,
Type type)
{
var result = new List<Expression>();
if (_valueFixtures.TryGetValue(type, out var valueFixture))
{
var generateMethodInfo = valueFixture.GetType().GetMethod(nameof(IValueFixture.Generate));
result.Add(Expression.Assign(generatedValue,
Expression.Convert(Expression.Call(Expression.Constant(valueFixture), generateMethodInfo),
generatedValue.Type)));
}
else if (type.IsTypedList())
{
var expressionList = new List<Expression>();
var elementType = type.GetGenericArguments()[0];
expressionList.Add(Expression.Assign(generatedValue, Expression.New(type)));
var index = Expression.Parameter(typeof(int), "i");
var addMi = type.GetMethod("Add", new[] { elementType });
var childValue = Expression.Parameter(elementType);
var loopBlock = new List<Expression>
{
GenerateValue(childValue, repeatCount, recursiveCount, elementType),
Expression.Call(generatedValue, addMi, childValue)
};
if (loopBlock.Count > 0)
{
var loopContent = Expression.Block(new[] { childValue, index }, loopBlock);
expressionList.Add(ForLoop(index, repeatCount, loopContent));
}
result.Add(MakeIfExpression(recursiveCount, expressionList));
}
else if (type.IsArray)
{
var elementType = type.GetElementType();
var index = Expression.Parameter(typeof(int), "i");
var arrayList = new List<Expression>
{
Expression.Assign(generatedValue, Expression.NewArrayBounds(elementType, repeatCount)),
ForLoop(index, repeatCount,
GenerateValue(Expression.ArrayAccess(generatedValue, index), repeatCount, recursiveCount,
elementType))
};
result.Add(MakeIfExpression(recursiveCount, arrayList));
}
else if (Nullable.GetUnderlyingType(type) != null)
{
var elementType = Nullable.GetUnderlyingType(type);
result.Add(GenerateValue(generatedValue, repeatCount, recursiveCount, elementType));
}
else if (type.GetTypeInfo().IsEnum)
{
if (!_valueFixtures.TryGetValue(type, out valueFixture))
{
valueFixture = new EnumValueFixture(type);
_valueFixtures.Add(valueFixture.Type, valueFixture);
}
result.Add(GenerateValue(generatedValue, repeatCount, recursiveCount,
type)); // call again for main method
}
else
{
result.Add(MakeIfExpression(recursiveCount,
InvokeCreate(type, generatedValue, repeatCount, recursiveCount)));
}
return result.Count > 1 ? Expression.Block(result) : result.Single();
}
private Expression InvokeCreate(Type type, Expression generatedValue, Expression repeatCount,
Expression recursiveCount)
{
var mi = typeof(ExpressionTreeFixture).GetMethod(nameof(Create),
new[] { typeof(Type), typeof(int), typeof(int) });
return Expression.Assign(generatedValue,
Expression.Convert(
Expression.Call(Expression.Constant(this), mi,
new[] { Expression.Constant(type), repeatCount, recursiveCount }),
generatedValue.Type));
}
private Expression MakeIfExpression(Expression recursiveCount, params Expression[] input)
{
return Expression.IfThen(Expression.GreaterThanOrEqual(recursiveCount, Expression.Constant(0)),
input.Length > 1 ? Expression.Block(input) : input.Single());
}
private Expression MakeIfExpression(Expression recursiveCount, IList<Expression> input)
{
return Expression.IfThen(Expression.GreaterThanOrEqual(recursiveCount, Expression.Constant(0)),
input.Count > 1 ? Expression.Block(input) : input.Single());
}
public T Create<T>(int repeatCount = 1, int recursiveCount = 1)
{
return (T)Create(typeof(T), repeatCount, recursiveCount);
}
public IEnumerable<T> CreateMany<T>(int count, int repeatCount = 1, int recursiveCount = 1)
{
return CreateMany(typeof(T), count, repeatCount, recursiveCount).Cast<T>();
}
public IEnumerable<object> CreateMany(Type type, int count, int repeatCount = 1, int recursiveCount = 1)
{
var functor = _functorCache.GetOrAdd(type, AddFunctor);
for (var i = 0; i < count; i++)
{
yield return functor(repeatCount, recursiveCount);
}
}
public static Expression ForLoop(ParameterExpression index, Expression lengthExpression, Expression loopContent)
{
var breakLabel = Expression.Label("LoopBreak");
var length = Expression.Variable(typeof(int), "length");
var block = Expression.Block(new[] { index, length },
Expression.Assign(index, Expression.Constant(0)),
Expression.Assign(length, lengthExpression),
Expression.Loop(
Expression.IfThenElse(
Expression.LessThan(index, length),
Expression.Block(loopContent, Expression.PostIncrementAssign(index)),
Expression.Break(breakLabel)
),
breakLabel)
);
return block;
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class FloatValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(float);
public object Generate()
{
return (float) _prng.Next() % 10000 + 0.5f;
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using System;
namespace Benchmark.Fixture
{
public class GuidValueFixture : IValueFixture
{
public Type Type { get; } = typeof(Guid);
public object Generate()
{
return Guid.NewGuid();
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
using System;
namespace Benchmark.Fixture
{
public interface IValueFixture
{
Type Type { get; }
object Generate();
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class IntValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(int);
public object Generate()
{
return _prng.Next();
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class LongValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(long);
public object Generate()
{
return ((long) _prng.Next() << 32) | (uint) _prng.Next();
}
}
}

Просмотреть файл

@ -0,0 +1,65 @@
using System;
using System.Runtime.CompilerServices;
namespace Benchmark.Fixture
{
public delegate T Converter<T>(ReadOnlySpan<byte> buffer);
public abstract class PrimitiveFixtureBase<T> : IValueFixture
where T : unmanaged
{
private readonly Random rand = new Random();
public Type Type => typeof(T);
public abstract object Generate();
protected unsafe object GenerateBytes(Converter<T> converter)
{
Span<byte> buffer = stackalloc byte[sizeof(T)];
rand.NextBytes(buffer);
return converter(buffer);
}
}
public class SByteValueFixture : PrimitiveFixtureBase<sbyte>
{
public override object Generate()
{
return GenerateBytes(x => unchecked((sbyte)x[0]));
}
}
public class UShortValueFixture : PrimitiveFixtureBase<ushort>
{
public override object Generate() => GenerateBytes(BitConverter.ToUInt16);
}
public class UInt32ValueFixture : PrimitiveFixtureBase<UInt32>
{
public override object Generate() => GenerateBytes(BitConverter.ToUInt32);
}
public class UInt64ValueFixture : PrimitiveFixtureBase<UInt64>
{
public override object Generate() => GenerateBytes(BitConverter.ToUInt64);
}
public class CharValueFixture : PrimitiveFixtureBase<Char>
{
public override object Generate() => GenerateBytes(BitConverter.ToChar);
}
public class ByteArrayFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(byte[]);
public object Generate()
{
var bytes = new byte[100];
_prng.NextBytes(bytes);
return bytes;
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using System;
namespace Benchmark.Fixture
{
public class ShortValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(short);
public object Generate()
{
return (short) (_prng.Next() & 0xFFFF);
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
using System;
namespace Benchmark.Fixture
{
public class StringValueFixture : IValueFixture
{
private readonly Random _prng = new Random();
public Type Type { get; } = typeof(string);
public object Generate()
{
return Generate(8);
}
private string Generate(int length)
{
const string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
var cArray = new char[length];
for (var i = 0; i < length; i++)
{
cArray[i] = chars[_prng.Next(chars.Length)];
}
return new string(cArray);
}
}
}

Просмотреть файл

@ -0,0 +1,8 @@
namespace Benchmark
{
public interface IGenericEquality<in T>
{
bool Equals(T obj);
bool EqualsDynamic(dynamic obj);
}
}

Двоичные данные
benchmark/SerializerBenchmark/MessagePack_1_7_3_6.dll Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,43 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class AccessToken : IGenericEquality<AccessToken>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string access_token { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public DateTime? expires_on_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public List<string> scope { get; set; }
public bool Equals(AccessToken obj)
{
return
access_token.TrueEqualsString(obj.access_token) ||
expires_on_date.TrueEquals(obj.expires_on_date) ||
account_id.TrueEquals(obj.account_id) ||
scope.TrueEqualsString(obj.scope);
}
public bool EqualsDynamic(dynamic obj)
{
return
access_token.TrueEqualsString((string)obj.access_token) ||
expires_on_date.TrueEquals((DateTime?)obj.expires_on_date) ||
account_id.TrueEquals((int?)obj.account_id) ||
scope.TrueEqualsString((IEnumerable<string>)obj.scope);
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class AccountMerge : IGenericEquality<AccountMerge>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? old_account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? new_account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? merge_date { get; set; }
public bool Equals(AccountMerge obj)
{
return
old_account_id.TrueEquals(obj.old_account_id) &&
new_account_id.TrueEquals(obj.new_account_id) &&
merge_date.TrueEquals(obj.merge_date);
}
public bool EqualsDynamic(dynamic obj)
{
return
old_account_id.TrueEquals((int?) obj.old_account_id) &&
new_account_id.TrueEquals((int?) obj.new_account_id) &&
merge_date.TrueEquals((DateTime?) obj.merge_date);
}
}
}

Просмотреть файл

@ -0,0 +1,142 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Answer : IGenericEquality<Answer>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? answer_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? locked_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? last_edit_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public DateTime? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public DateTime? community_owned_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public bool? is_accepted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public ShallowUser owner { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public int? up_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public int? down_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public List<Comment> comments { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public bool? upvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(19), oldmsgpack::MessagePack.Key(19 - 1), newmsgpack::MessagePack.Key(19 - 1)]
public bool? downvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(20), oldmsgpack::MessagePack.Key(20 - 1), newmsgpack::MessagePack.Key(20 - 1)]
public bool? accepted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(21), oldmsgpack::MessagePack.Key(21 - 1), newmsgpack::MessagePack.Key(21 - 1)]
public ShallowUser last_editor { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(22), oldmsgpack::MessagePack.Key(22 - 1), newmsgpack::MessagePack.Key(22 - 1)]
public int? comment_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(23), oldmsgpack::MessagePack.Key(23 - 1), newmsgpack::MessagePack.Key(23 - 1)]
public string body_markdown { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(24), oldmsgpack::MessagePack.Key(24 - 1), newmsgpack::MessagePack.Key(24 - 1)]
public string share_link { get; set; }
public bool Equals(Answer obj)
{
return
accepted.TrueEquals(obj.accepted) &&
answer_id.TrueEquals(obj.answer_id) &&
body.TrueEqualsString(obj.body) &&
body_markdown.TrueEqualsString(obj.body_markdown) &&
comment_count.TrueEquals(obj.comment_count) &&
comments.TrueEqualsList(obj.comments) &&
community_owned_date.TrueEquals(obj.community_owned_date) &&
creation_date.TrueEquals(obj.creation_date) &&
down_vote_count.TrueEquals(obj.down_vote_count) &&
downvoted.TrueEquals(obj.downvoted) &&
is_accepted.TrueEquals(obj.is_accepted) &&
last_activity_date.TrueEquals(obj.last_activity_date) &&
last_edit_date.TrueEquals(obj.last_edit_date) &&
last_editor.TrueEquals(obj.last_editor) &&
link.TrueEqualsString(obj.link) &&
locked_date.TrueEquals(obj.locked_date) &&
owner.TrueEquals(obj.owner) &&
question_id.TrueEquals(obj.question_id) &&
score.TrueEquals(obj.score) &&
share_link.TrueEqualsString(obj.share_link) &&
tags.TrueEqualsString(obj.tags) &&
title.TrueEqualsString(obj.title) &&
up_vote_count.TrueEquals(obj.up_vote_count) &&
upvoted.TrueEquals(obj.upvoted);
}
public bool EqualsDynamic(dynamic obj)
{
return
accepted.TrueEquals((bool?) obj.accepted) &&
answer_id.TrueEquals((int?) obj.answer_id) &&
body.TrueEqualsString((string) obj.body) &&
body_markdown.TrueEqualsString((string) obj.body_markdown) &&
comment_count.TrueEquals((int?) obj.comment_count) &&
comments.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.comments) &&
community_owned_date.TrueEquals((DateTime?) obj.community_owned_date) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
down_vote_count.TrueEquals((int?) obj.down_vote_count) &&
downvoted.TrueEquals((bool?) obj.downvoted) &&
is_accepted.TrueEquals((bool?) obj.is_accepted) &&
last_activity_date.TrueEquals((DateTime?) obj.last_activity_date) &&
last_edit_date.TrueEquals((DateTime?) obj.last_edit_date) &&
(last_editor == null && obj.last_editor == null || last_editor.EqualsDynamic(obj.last_editor)) &&
link.TrueEqualsString((string) obj.link) &&
locked_date.TrueEquals((DateTime?) obj.locked_date) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
question_id.TrueEquals((int?) obj.question_id) &&
score.TrueEquals((int?) obj.score) &&
share_link.TrueEqualsString((string) obj.share_link) &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title.TrueEqualsString((string) obj.title) &&
up_vote_count.TrueEquals((int?) obj.up_vote_count) &&
upvoted.TrueEquals((bool?) obj.upvoted);
}
}
}

Просмотреть файл

@ -0,0 +1,73 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
public enum BadgeRank : byte
{
bronze = 3,
silver = 2,
gold = 1
}
public enum BadgeType
{
named = 1,
tag_based = 2
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Badge : IGenericEquality<Badge>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? badge_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public BadgeRank? rank { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? award_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public BadgeType? badge_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public ShallowUser user { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public string link { get; set; }
public bool Equals(Badge obj)
{
return
award_count.TrueEquals(obj.award_count) &&
badge_id.TrueEquals(obj.badge_id) &&
badge_type.TrueEquals(obj.badge_type) &&
description.TrueEqualsString(obj.description) &&
link.TrueEqualsString(obj.link) &&
name.TrueEqualsString(obj.name) &&
rank.TrueEquals(obj.rank) &&
user.TrueEquals(obj.user);
}
public bool EqualsDynamic(dynamic obj)
{
return
award_count.TrueEquals((int?) obj.award_count) &&
badge_id.TrueEquals((int?) obj.badge_id) &&
badge_type.TrueEquals((BadgeType?) obj.badge_type) &&
description.TrueEqualsString((string) obj.description) &&
link.TrueEqualsString((string) obj.link) &&
name.TrueEqualsString((string) obj.name) &&
rank.TrueEquals((BadgeRank?) obj.rank) &&
(user == null && obj.user == null || user.EqualsDynamic(obj.user));
}
}
}

Просмотреть файл

@ -0,0 +1,88 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum PostType : byte
{
question = 1,
answer = 2
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Comment : IGenericEquality<Comment>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? comment_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public bool? edited { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public ShallowUser owner { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public ShallowUser reply_to_user { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public string body_markdown { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public bool? upvoted { get; set; }
public bool Equals(Comment obj)
{
return
body.TrueEqualsString(obj.body) &&
body_markdown.TrueEqualsString(obj.body_markdown) &&
comment_id.TrueEquals(obj.comment_id) &&
creation_date.TrueEquals(obj.creation_date) &&
edited.TrueEquals(obj.edited) &&
link.TrueEqualsString(obj.link) &&
owner.TrueEquals(obj.owner) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
reply_to_user.TrueEquals(obj.reply_to_user) &&
score.TrueEquals(obj.score) &&
upvoted.TrueEquals(obj.upvoted);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
body_markdown.TrueEqualsString((string) obj.body_markdown) &&
comment_id.TrueEquals((int?) obj.comment_id) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
edited.TrueEquals((bool?) obj.edited) &&
link.TrueEqualsString((string) obj.link) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
(reply_to_user == null && obj.reply_to_user == null ||
reply_to_user.EqualsDynamic(obj.reply_to_user)) &&
score.TrueEquals((int?) obj.score) &&
upvoted.TrueEquals((bool?) obj.upvoted);
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Error : IGenericEquality<Error>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? error_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string error_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string description { get; set; }
public bool Equals(Error obj)
{
return
error_id.TrueEquals(obj.error_id) &&
error_name.TrueEqualsString(obj.error_name) &&
description.TrueEqualsString(obj.description);
}
public bool EqualsDynamic(dynamic obj)
{
return
error_id.TrueEquals((int?) obj.error_id) &&
error_name.TrueEqualsString((string) obj.error_name) &&
description.TrueEqualsString((string) obj.description);
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum EventType : byte
{
question_posted = 1,
answer_posted = 2,
comment_posted = 3,
post_edited = 4,
user_created = 5
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Event : IGenericEquality<Event>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public EventType? event_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? event_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string excerpt { get; set; }
public bool Equals(Event obj)
{
return
creation_date.TrueEquals(obj.creation_date) &&
event_id.TrueEquals(obj.event_id) &&
event_type.TrueEquals(obj.event_type) &&
excerpt.TrueEqualsString(obj.excerpt) &&
link.TrueEqualsString(obj.link);
}
public bool EqualsDynamic(dynamic obj)
{
return
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
event_id.TrueEquals((int?) obj.event_id) &&
event_type.TrueEquals((EventType?) obj.event_type) &&
excerpt.TrueEqualsString((string) obj.excerpt) &&
link.TrueEqualsString((string) obj.link);
}
}
}

Просмотреть файл

@ -0,0 +1,688 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class MobileFeed : IGenericEquality<MobileFeed>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public List<MobileQuestion> hot_questions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public List<MobileInboxItem> inbox_items { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public List<MobileQuestion> likely_to_answer_questions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public List<MobileRepChange> reputation_events { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public List<MobileQuestion> cross_site_interesting_questions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public List<MobileBadgeAward> badges { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public List<MobilePrivilege> earned_privileges { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public List<MobilePrivilege> upcoming_privileges { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public List<MobileCommunityBulletin> community_bulletins { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public List<MobileAssociationBonus> association_bonuses { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public List<MobileCareersJobAd> careers_job_ads { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public List<MobileBannerAd> banner_ads { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public long? before { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public long? since { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public int? account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public MobileUpdateNotice update_notice { get; set; }
public bool Equals(MobileFeed obj)
{
return
account_id == obj.account_id &&
association_bonuses.TrueEqualsList(obj.association_bonuses) &&
badges.TrueEqualsList(obj.badges) &&
banner_ads.TrueEqualsList(obj.banner_ads) &&
before == obj.before &&
careers_job_ads.TrueEqualsList(obj.careers_job_ads) &&
community_bulletins.TrueEqualsList(obj.community_bulletins) &&
cross_site_interesting_questions.TrueEqualsList(obj.cross_site_interesting_questions) &&
earned_privileges.TrueEqualsList(obj.earned_privileges) &&
hot_questions.TrueEqualsList(obj.hot_questions) &&
inbox_items.TrueEqualsList(obj.inbox_items) &&
likely_to_answer_questions.TrueEqualsList(obj.likely_to_answer_questions) &&
reputation_events.TrueEqualsList(obj.reputation_events) &&
since == obj.since &&
upcoming_privileges.TrueEqualsList(obj.upcoming_privileges) &&
update_notice.TrueEquals(obj.update_notice);
}
public bool EqualsDynamic(dynamic obj)
{
return
account_id == (int?) obj.account_id &&
association_bonuses.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.association_bonuses) &&
badges.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.badges) &&
banner_ads.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.banner_ads) &&
before == (long?) obj.before &&
careers_job_ads.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.careers_job_ads) &&
community_bulletins.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.community_bulletins) &&
cross_site_interesting_questions.TrueEqualsListDynamic(
(IEnumerable<dynamic>) obj.cross_site_interesting_questions) &&
earned_privileges.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.earned_privileges) &&
hot_questions.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.hot_questions) &&
inbox_items.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.inbox_items) &&
likely_to_answer_questions.TrueEqualsListDynamic(
(IEnumerable<dynamic>) obj.likely_to_answer_questions) &&
reputation_events.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.reputation_events) &&
since == (long?) obj.since &&
upcoming_privileges.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.upcoming_privileges) &&
(update_notice == null && obj.update_notice == null || update_notice.EqualsDynamic(obj.update_notice));
}
}
public interface IMobileFeedBase<T> : IGenericEquality<T>
{
int? group_id { get; set; }
long? added_date { get; set; }
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileQuestion : IMobileFeedBase<MobileQuestion>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public long? question_creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public long? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public bool? is_deleted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public bool? has_accepted_answer { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileQuestion obj)
{
return
added_date == obj.added_date &&
answer_count == obj.answer_count &&
group_id == obj.group_id &&
has_accepted_answer == obj.has_accepted_answer &&
is_deleted == obj.is_deleted &&
last_activity_date == obj.last_activity_date &&
question_creation_date == obj.question_creation_date &&
question_id == obj.question_id &&
site == obj.site &&
tags.TrueEqualsString(obj.tags) &&
title == obj.title;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
answer_count == (int?) obj.answer_count &&
group_id == (int?) obj.group_id &&
has_accepted_answer == (bool?) obj.has_accepted_answer &&
is_deleted == (bool?) obj.is_deleted &&
last_activity_date == (long?) obj.last_activity_date &&
question_creation_date == (long?) obj.question_creation_date &&
question_id == (int?) obj.question_id &&
site == (string) obj.site &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title == (string) obj.title;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileRepChange : IMobileFeedBase<MobileRepChange>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? rep_change { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileRepChange obj)
{
return
added_date == obj.added_date &&
group_id == obj.group_id &&
link == obj.link &&
rep_change == obj.rep_change &&
site == obj.site &&
title == obj.title;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
group_id == (int?) obj.group_id &&
link == (string) obj.link &&
rep_change == (int?) obj.rep_change &&
site == (string) obj.site &&
title == (string) obj.title;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileInboxItem : IMobileFeedBase<MobileInboxItem>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? answer_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? comment_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public long? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public string item_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileInboxItem obj)
{
return
added_date == obj.added_date &&
answer_id == obj.answer_id &&
body == obj.body &&
comment_id == obj.comment_id &&
creation_date == obj.creation_date &&
group_id == obj.group_id &&
item_type == obj.item_type &&
link == obj.link &&
question_id == obj.question_id &&
site == obj.site &&
title == obj.title;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
answer_id == (int?) obj.answer_id &&
body == (string) obj.body &&
comment_id == (int?) obj.comment_id &&
creation_date == (long?) obj.creation_date &&
group_id == (int?) obj.group_id &&
item_type == (string) obj.item_type &&
link == (string) obj.link &&
question_id == (int?) obj.question_id &&
site == (string) obj.site &&
title == (string) obj.title;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileBadgeAward : IMobileFeedBase<MobileBadgeAward>
{
public enum BadgeRank : byte
{
bronze = 1,
silver = 2,
gold = 3
}
public enum BadgeType
{
named = 1,
tag_based = 2
}
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string badge_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string badge_description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? badge_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public BadgeRank? rank { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public BadgeType? badge_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileBadgeAward obj)
{
return
added_date == obj.added_date &&
badge_description == obj.badge_description &&
badge_id == obj.badge_id &&
badge_name == obj.badge_name &&
badge_type == obj.badge_type &&
group_id == obj.group_id &&
link == obj.link &&
post_id == obj.post_id &&
rank == obj.rank &&
site == obj.site;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
badge_description == (string) obj.badge_description &&
badge_id == (int?) obj.badge_id &&
badge_name == (string) obj.badge_name &&
badge_type == (BadgeType?) obj.badge_type &&
group_id == (int?) obj.group_id &&
link == (string) obj.link &&
post_id == (int?) obj.post_id &&
rank == (BadgeRank?) obj.rank &&
site == (string) obj.site;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobilePrivilege : IMobileFeedBase<MobilePrivilege>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string privilege_short_description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string privilege_long_description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? privilege_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? reputation_required { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobilePrivilege obj)
{
return
added_date == obj.added_date &&
group_id == obj.group_id &&
link == obj.link &&
privilege_id == obj.privilege_id &&
privilege_long_description == obj.privilege_long_description &&
privilege_short_description == obj.privilege_short_description &&
reputation_required == obj.reputation_required &&
site == obj.site;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
group_id == (int?) obj.group_id &&
link == (string) obj.link &&
privilege_id == (int?) obj.privilege_id &&
privilege_long_description == (string) obj.privilege_long_description &&
privilege_short_description == (string) obj.privilege_short_description &&
reputation_required == (int?) obj.reputation_required &&
site == (string) obj.site;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileCommunityBulletin : IMobileFeedBase<MobileCommunityBulletin>
{
public enum CommunityBulletinType : byte
{
blog_post = 1,
featured_meta_question = 2,
upcoming_event = 3
}
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public CommunityBulletinType? bulletin_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public long? begin_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public long? end_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public string custom_date_string { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public bool? is_deleted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public bool? has_accepted_answer { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public bool? is_promoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileCommunityBulletin obj)
{
return
added_date == obj.added_date &&
answer_count == obj.answer_count &&
begin_date == obj.begin_date &&
bulletin_type == obj.bulletin_type &&
custom_date_string == obj.custom_date_string &&
end_date == obj.end_date &&
group_id == obj.group_id &&
has_accepted_answer == obj.has_accepted_answer &&
is_deleted == obj.is_deleted &&
is_promoted == obj.is_promoted &&
link == obj.link &&
site == obj.site &&
tags.TrueEqualsString(obj.tags) &&
title == obj.title;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
answer_count == (int?) obj.answer_count &&
begin_date == (long?) obj.begin_date &&
bulletin_type == (CommunityBulletinType?) obj.bulletin_type &&
custom_date_string == (string) obj.custom_date_string &&
end_date == (long?) obj.end_date &&
group_id == (int?) obj.group_id &&
has_accepted_answer == (bool?) obj.has_accepted_answer &&
is_deleted == (bool?) obj.is_deleted &&
is_promoted == (bool?) obj.is_promoted &&
link == (string) obj.link &&
site == (string) obj.site &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title == (string) obj.title;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileAssociationBonus : IMobileFeedBase<MobileAssociationBonus>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? amount { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileAssociationBonus obj)
{
return
added_date == obj.added_date &&
amount == obj.amount &&
group_id == obj.group_id &&
site == obj.site;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
amount == (int?) obj.amount &&
group_id == (int?) obj.group_id &&
site == (string) obj.site;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileCareersJobAd : IMobileFeedBase<MobileCareersJobAd>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? job_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string company_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string location { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileCareersJobAd obj)
{
return
added_date == obj.added_date &&
company_name == obj.company_name &&
group_id == obj.group_id &&
job_id == obj.job_id &&
link == obj.link &&
location == obj.location &&
title == obj.title;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
company_name == (string) obj.company_name &&
group_id == (int?) obj.group_id &&
job_id == (int?) obj.job_id &&
link == (string) obj.link &&
location == (string) obj.location &&
title == (string) obj.title;
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileBannerAd : IMobileFeedBase<MobileBannerAd>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public List<MobileBannerAdImage> images { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? group_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public long? added_date { get; set; }
public bool Equals(MobileBannerAd obj)
{
return
added_date == obj.added_date &&
group_id == obj.group_id &&
images.TrueEqualsList(obj.images) &&
link == obj.link;
}
public bool EqualsDynamic(dynamic obj)
{
return
added_date == (long?) obj.added_date &&
group_id == (int?) obj.group_id &&
images.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.images) &&
link == (string) obj.link;
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileBannerAdImage : IGenericEquality<MobileBannerAdImage>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string image_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? width { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? height { get; set; }
public bool Equals(MobileBannerAdImage obj)
{
return
height == obj.height &&
image_url == obj.image_url &&
width == obj.width;
}
public bool EqualsDynamic(dynamic obj)
{
return
height == (int?) obj.height &&
image_url == (string) obj.image_url &&
width == (int?) obj.width;
}
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public sealed class MobileUpdateNotice : IGenericEquality<MobileUpdateNotice>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public bool? should_update { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string message { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string minimum_supported_version { get; set; }
public bool Equals(MobileUpdateNotice obj)
{
return
message == obj.message &&
minimum_supported_version == obj.minimum_supported_version &&
should_update == obj.should_update;
}
public bool EqualsDynamic(dynamic obj)
{
return
message == (string) obj.message &&
minimum_supported_version == (string) obj.minimum_supported_version &&
should_update == (bool?) obj.should_update;
}
}
}

Просмотреть файл

@ -0,0 +1,66 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class FlagOption : IGenericEquality<FlagOption>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? option_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public bool? requires_comment { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public bool? requires_site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public bool? requires_question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public List<FlagOption> sub_options { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public bool? has_flagged { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? count { get; set; }
public bool Equals(FlagOption obj)
{
return
count.TrueEquals(obj.count) &&
description.TrueEqualsString(obj.description) &&
has_flagged.TrueEquals(obj.has_flagged) &&
option_id.TrueEquals(obj.option_id) &&
requires_comment.TrueEquals(obj.requires_comment) &&
requires_question_id.TrueEquals(obj.requires_question_id) &&
requires_site.TrueEquals(obj.requires_site) &&
sub_options.TrueEqualsList(obj.sub_options) &&
title.TrueEqualsString(obj.title);
}
public bool EqualsDynamic(dynamic obj)
{
return
count.TrueEquals((int?) obj.count) &&
description.TrueEqualsString((string) obj.description) &&
has_flagged.TrueEquals((bool?) obj.has_flagged) &&
option_id.TrueEquals((int?) obj.option_id) &&
requires_comment.TrueEquals((bool?) obj.requires_comment) &&
requires_question_id.TrueEquals((bool?) obj.requires_question_id) &&
requires_site.TrueEquals((bool?) obj.requires_site) &&
sub_options.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.sub_options) &&
title.TrueEqualsString((string) obj.title);
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum InboxItemType
{
comment = 1,
chat_message = 2,
new_answer = 3,
careers_message = 4,
careers_invitations = 5,
meta_question = 6,
post_notice = 7,
moderator_message = 8
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class InboxItem : IGenericEquality<InboxItem>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public InboxItemType? item_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? answer_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? comment_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public bool? is_unread { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public Info.Site site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string link { get; set; }
public bool Equals(InboxItem obj)
{
return
answer_id.TrueEquals(obj.answer_id) &&
body.TrueEqualsString(obj.body) &&
comment_id.TrueEquals(obj.comment_id) &&
creation_date.TrueEquals(obj.creation_date) &&
is_unread.TrueEquals(obj.is_unread) &&
item_type.TrueEquals(obj.item_type) &&
link.TrueEqualsString(obj.link) &&
question_id.TrueEquals(obj.question_id) &&
site.TrueEquals(obj.site) &&
title.TrueEqualsString(obj.title);
}
public bool EqualsDynamic(dynamic obj)
{
return
answer_id.TrueEquals((int?) obj.answer_id) &&
body.TrueEqualsString((string) obj.body) &&
comment_id.TrueEquals((int?) obj.comment_id) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
is_unread.TrueEquals((bool?) obj.is_unread) &&
item_type.TrueEquals((InboxItemType?) obj.item_type) &&
link.TrueEqualsString((string) obj.link) &&
question_id.TrueEquals((int?) obj.question_id) &&
(site == null && obj.site == null || site.EqualsDynamic(obj.site)) &&
title.TrueEqualsString((string) obj.title);
}
}
}

Просмотреть файл

@ -0,0 +1,272 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Info : IGenericEquality<Info>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? total_questions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? total_unanswered { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? total_accepted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? total_answers { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public decimal? questions_per_minute { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public decimal? answers_per_minute { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? total_comments { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public int? total_votes { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? total_badges { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public decimal? badges_per_minute { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public int? total_users { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public int? new_active_users { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public string api_revision { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public Site site { get; set; }
public bool Equals(Info obj)
{
return
answers_per_minute.TrueEquals(obj.answers_per_minute) &&
api_revision.TrueEqualsString(obj.api_revision) &&
badges_per_minute.TrueEquals(obj.badges_per_minute) &&
new_active_users.TrueEquals(obj.new_active_users) &&
questions_per_minute.TrueEquals(obj.questions_per_minute) &&
site.TrueEquals(obj.site) &&
total_accepted.TrueEquals(obj.total_accepted) &&
total_answers.TrueEquals(obj.total_answers) &&
total_badges.TrueEquals(obj.total_badges) &&
total_comments.TrueEquals(obj.total_comments) &&
total_questions.TrueEquals(obj.total_questions) &&
total_unanswered.TrueEquals(obj.total_unanswered) &&
total_users.TrueEquals(obj.total_users) &&
total_votes.TrueEquals(obj.total_votes);
}
public bool EqualsDynamic(dynamic obj)
{
return
answers_per_minute.TrueEquals((decimal?) obj.answers_per_minute) &&
api_revision.TrueEqualsString((string) obj.api_revision) &&
badges_per_minute.TrueEquals((decimal?) obj.badges_per_minute) &&
new_active_users.TrueEquals((int?) obj.new_active_users) &&
questions_per_minute.TrueEquals((decimal?) obj.questions_per_minute) &&
(site == null && obj.site == null || site.EqualsDynamic(obj.site)) &&
total_accepted.TrueEquals((int?) obj.total_accepted) &&
total_answers.TrueEquals((int?) obj.total_answers) &&
total_badges.TrueEquals((int?) obj.total_badges) &&
total_comments.TrueEquals((int?) obj.total_comments) &&
total_questions.TrueEquals((int?) obj.total_questions) &&
total_unanswered.TrueEquals((int?) obj.total_unanswered) &&
total_users.TrueEquals((int?) obj.total_users) &&
total_votes.TrueEquals((int?) obj.total_votes);
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Site : IGenericEquality<Site>
{
public enum SiteState
{
normal,
closed_beta,
open_beta,
linked_meta
}
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string site_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string logo_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string api_site_parameter { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string site_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string audience { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public string icon_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public List<string> aliases { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public SiteState? site_state { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public Styling styling { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public DateTime? closed_beta_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public DateTime? open_beta_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public DateTime? launch_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public string favicon_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public List<RelatedSite> related_sites { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public string twitter_account { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public List<string> markdown_extensions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public string high_resolution_icon_url { get; set; }
public bool Equals(Site obj)
{
return
aliases.TrueEqualsString(obj.aliases) &&
api_site_parameter.TrueEqualsString(obj.api_site_parameter) &&
audience.TrueEqualsString(obj.audience) &&
closed_beta_date.TrueEquals(obj.closed_beta_date) &&
favicon_url.TrueEqualsString(obj.favicon_url) &&
high_resolution_icon_url.TrueEqualsString(obj.high_resolution_icon_url) &&
icon_url.TrueEqualsString(obj.icon_url) &&
launch_date.TrueEquals(obj.launch_date) &&
logo_url.TrueEqualsString(obj.logo_url) &&
markdown_extensions.TrueEqualsString(obj.markdown_extensions) &&
name.TrueEqualsString(obj.name) &&
open_beta_date.TrueEquals(obj.open_beta_date) &&
related_sites.TrueEqualsList(obj.related_sites) &&
site_state.TrueEquals(obj.site_state) &&
site_type.TrueEqualsString(obj.site_type) &&
site_url.TrueEqualsString(obj.site_url) &&
styling.TrueEquals(obj.styling) &&
twitter_account.TrueEqualsString(obj.twitter_account);
}
public bool EqualsDynamic(dynamic obj)
{
return
aliases.TrueEqualsString((IEnumerable<string>) obj.aliases) &&
api_site_parameter.TrueEqualsString((string) obj.api_site_parameter) &&
audience.TrueEqualsString((string) obj.audience) &&
closed_beta_date.TrueEquals((DateTime?) obj.closed_beta_date) &&
favicon_url.TrueEqualsString((string) obj.favicon_url) &&
high_resolution_icon_url.TrueEqualsString((string) obj.high_resolution_icon_url) &&
icon_url.TrueEqualsString((string) obj.icon_url) &&
launch_date.TrueEquals((DateTime?) obj.launch_date) &&
logo_url.TrueEqualsString((string) obj.logo_url) &&
markdown_extensions.TrueEqualsString((IEnumerable<string>) obj.markdown_extensions) &&
name.TrueEqualsString((string) obj.name) &&
open_beta_date.TrueEquals((DateTime?) obj.open_beta_date) &&
related_sites.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.related_sites) &&
site_state.TrueEquals((SiteState?) obj.site_state) &&
site_type.TrueEqualsString((string) obj.site_type) &&
site_url.TrueEqualsString((string) obj.site_url) &&
(styling == null && obj.styling == null || styling.EqualsDynamic(obj.styling)) &&
twitter_account.TrueEqualsString((string) obj.twitter_account);
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Styling : IGenericEquality<Styling>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string link_color { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string tag_foreground_color { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string tag_background_color { get; set; }
public bool Equals(Styling obj)
{
return
link_color.TrueEqualsString(obj.link_color) &&
tag_background_color.TrueEqualsString(obj.tag_background_color) &&
tag_foreground_color.TrueEqualsString(obj.tag_foreground_color);
}
public bool EqualsDynamic(dynamic obj)
{
return
link_color.TrueEqualsString((string) obj.link_color) &&
tag_background_color.TrueEqualsString((string) obj.tag_background_color) &&
tag_foreground_color.TrueEqualsString((string) obj.tag_foreground_color);
}
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class RelatedSite : IGenericEquality<RelatedSite>
{
public enum SiteRelation
{
parent,
meta,
chat
}
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string site_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public SiteRelation? relation { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string api_site_parameter { get; set; }
public bool Equals(RelatedSite obj)
{
return
name.TrueEqualsString(obj.name) &&
relation.TrueEquals(obj.relation) &&
api_site_parameter.TrueEqualsString(obj.api_site_parameter);
}
public bool EqualsDynamic(dynamic obj)
{
return
name.TrueEqualsString((string) obj.name) &&
relation.TrueEquals((SiteRelation?) obj.relation) &&
api_site_parameter.TrueEqualsString((string) obj.api_site_parameter);
}
}
}
}

Просмотреть файл

@ -0,0 +1,76 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class NetworkUser : IGenericEquality<NetworkUser>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string site_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string site_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? reputation { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public UserType? user_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public User.BadgeCount badge_counts { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public DateTime? last_access_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public int? question_count { get; set; }
public bool Equals(NetworkUser obj)
{
return
account_id.TrueEquals(obj.account_id) &&
answer_count.TrueEquals(obj.answer_count) &&
badge_counts.TrueEquals(obj.badge_counts) &&
creation_date.TrueEquals(obj.creation_date) &&
last_access_date.TrueEquals(obj.last_access_date) &&
question_count.TrueEquals(obj.question_count) &&
reputation.TrueEquals(obj.reputation) &&
site_name.TrueEqualsString(obj.site_name) &&
site_url.TrueEqualsString(obj.site_url) &&
user_id.TrueEquals(obj.user_id) &&
user_type.TrueEquals(obj.user_type);
}
public bool EqualsDynamic(dynamic obj)
{
return
account_id.TrueEquals((int?) obj.account_id) &&
answer_count.TrueEquals((int?) obj.answer_count) &&
(badge_counts == null && obj.badge_counts == null || badge_counts.EqualsDynamic(obj.badge_counts)) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
last_access_date.TrueEquals((DateTime?) obj.last_access_date) &&
question_count.TrueEquals((int?) obj.question_count) &&
reputation.TrueEquals((int?) obj.reputation) &&
site_name.TrueEqualsString((string) obj.site_name) &&
site_url.TrueEqualsString((string) obj.site_url) &&
user_id.TrueEquals((int?) obj.user_id) &&
user_type.TrueEquals((UserType?) obj.user_type);
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum NotificationType : byte
{
generic = 1,
accounts_associated = 8,
badge_earned = 5,
profile_activity = 2,
bounty_expired = 3,
bounty_expires_in_one_day = 4,
bounty_expires_in_three_days = 6,
edit_suggested = 22,
new_privilege = 9,
post_migrated = 10,
moderator_message = 11,
registration_reminder = 12,
substantive_edit = 23,
reputation_bonus = 7,
bounty_grace_period_started = 24
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Notification : IGenericEquality<Notification>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public NotificationType? notification_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public Info.Site site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public bool? is_unread { get; set; }
public bool Equals(Notification obj)
{
return
body.TrueEqualsString(obj.body) &&
site.TrueEquals(obj.site) &&
creation_date.TrueEquals(obj.creation_date) &&
post_id.TrueEquals(obj.post_id) &&
is_unread.TrueEquals(obj.is_unread);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
(site == null && obj.site == null || site.EqualsDynamic(obj.site)) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
post_id.TrueEquals((int?) obj.post_id) &&
is_unread.TrueEquals((bool?) obj.is_unread);
}
}
}

Просмотреть файл

@ -0,0 +1,112 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Post : IGenericEquality<Post>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public ShallowUser owner { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public DateTime? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public DateTime? last_edit_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? up_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public int? down_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public List<Comment> comments { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public bool? upvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public bool? downvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public ShallowUser last_editor { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public int? comment_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public string body_markdown { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public string share_link { get; set; }
public bool Equals(Post obj)
{
return
body.TrueEqualsString(obj.body) &&
body_markdown.TrueEqualsString(obj.body_markdown) &&
comment_count.TrueEquals(obj.comment_count) &&
comments.TrueEqualsList(obj.comments) &&
creation_date.TrueEquals(obj.creation_date) &&
down_vote_count.TrueEquals(obj.down_vote_count) &&
downvoted.TrueEquals(obj.downvoted) &&
last_activity_date.TrueEquals(obj.last_activity_date) &&
last_edit_date.TrueEquals(obj.last_edit_date) &&
last_editor.TrueEquals(obj.last_editor) &&
link.TrueEqualsString(obj.link) &&
owner.TrueEquals(obj.owner) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
score.TrueEquals(obj.score) &&
share_link.TrueEqualsString(obj.share_link) &&
up_vote_count.TrueEquals(obj.up_vote_count) &&
upvoted.TrueEquals(obj.upvoted);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
body_markdown.TrueEqualsString((string) obj.body_markdown) &&
comment_count.TrueEquals((int?) obj.comment_count) &&
comments.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.comments) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
down_vote_count.TrueEquals((int?) obj.down_vote_count) &&
downvoted.TrueEquals((bool?) obj.downvoted) &&
last_activity_date.TrueEquals((DateTime?) obj.last_activity_date) &&
last_edit_date.TrueEquals((DateTime?) obj.last_edit_date) &&
(last_editor == null && obj.last_editor == null || last_editor.EqualsDynamic(obj.last_editor)) &&
link.TrueEqualsString((string) obj.link) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
score.TrueEquals((int?) obj.score) &&
share_link.TrueEqualsString((string) obj.share_link) &&
up_vote_count.TrueEquals((int?) obj.up_vote_count) &&
upvoted.TrueEquals((bool?) obj.upvoted);
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Privilege : IGenericEquality<Privilege>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string short_description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? reputation { get; set; }
public bool Equals(Privilege obj)
{
return
description.TrueEqualsString(obj.description) &&
reputation.TrueEquals(obj.reputation) &&
short_description.TrueEqualsString(obj.short_description);
}
public bool EqualsDynamic(dynamic obj)
{
return
description.TrueEqualsString((string) obj.description) &&
reputation.TrueEquals((int?) obj.reputation) &&
short_description.TrueEqualsString((string) obj.short_description);
}
}
}

Просмотреть файл

@ -0,0 +1,359 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Question : IGenericEquality<Question>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public DateTime? last_edit_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public DateTime? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? locked_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public DateTime? community_owned_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? accepted_answer_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public MigrationInfo migrated_to { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public MigrationInfo migrated_from { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public DateTime? bounty_closes_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public int? bounty_amount { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public DateTime? closed_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public DateTime? protected_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(19), oldmsgpack::MessagePack.Key(19 - 1), newmsgpack::MessagePack.Key(19 - 1)]
public string closed_reason { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(20), oldmsgpack::MessagePack.Key(20 - 1), newmsgpack::MessagePack.Key(20 - 1)]
public int? up_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(21), oldmsgpack::MessagePack.Key(21 - 1), newmsgpack::MessagePack.Key(21 - 1)]
public int? down_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(22), oldmsgpack::MessagePack.Key(22 - 1), newmsgpack::MessagePack.Key(22 - 1)]
public int? favorite_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(23), oldmsgpack::MessagePack.Key(23 - 1), newmsgpack::MessagePack.Key(23 - 1)]
public int? view_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(24), oldmsgpack::MessagePack.Key(24 - 1), newmsgpack::MessagePack.Key(24 - 1)]
public ShallowUser owner { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(25), oldmsgpack::MessagePack.Key(25 - 1), newmsgpack::MessagePack.Key(25 - 1)]
public List<Comment> comments { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(26), oldmsgpack::MessagePack.Key(26 - 1), newmsgpack::MessagePack.Key(26 - 1)]
public List<Answer> answers { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(27), oldmsgpack::MessagePack.Key(27 - 1), newmsgpack::MessagePack.Key(27 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(28), oldmsgpack::MessagePack.Key(28 - 1), newmsgpack::MessagePack.Key(28 - 1)]
public bool? is_answered { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(29), oldmsgpack::MessagePack.Key(29 - 1), newmsgpack::MessagePack.Key(29 - 1)]
public int? close_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(30), oldmsgpack::MessagePack.Key(30 - 1), newmsgpack::MessagePack.Key(30 - 1)]
public int? reopen_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(31), oldmsgpack::MessagePack.Key(31 - 1), newmsgpack::MessagePack.Key(31 - 1)]
public int? delete_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(32), oldmsgpack::MessagePack.Key(32 - 1), newmsgpack::MessagePack.Key(32 - 1)]
public Notice notice { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(33), oldmsgpack::MessagePack.Key(33 - 1), newmsgpack::MessagePack.Key(33 - 1)]
public bool? upvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(34), oldmsgpack::MessagePack.Key(34 - 1), newmsgpack::MessagePack.Key(34 - 1)]
public bool? downvoted { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(35), oldmsgpack::MessagePack.Key(35 - 1), newmsgpack::MessagePack.Key(35 - 1)]
public bool? favorited { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(36), oldmsgpack::MessagePack.Key(36 - 1), newmsgpack::MessagePack.Key(36 - 1)]
public ShallowUser last_editor { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(37), oldmsgpack::MessagePack.Key(37 - 1), newmsgpack::MessagePack.Key(37 - 1)]
public int? comment_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(38), oldmsgpack::MessagePack.Key(38 - 1), newmsgpack::MessagePack.Key(38 - 1)]
public string body_markdown { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(39), oldmsgpack::MessagePack.Key(39 - 1), newmsgpack::MessagePack.Key(39 - 1)]
public ClosedDetails closed_details { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(40), oldmsgpack::MessagePack.Key(40 - 1), newmsgpack::MessagePack.Key(40 - 1)]
public string share_link { get; set; }
public bool Equals(Question obj)
{
return
accepted_answer_id.TrueEquals(obj.accepted_answer_id) &&
answer_count.TrueEquals(obj.answer_count) &&
answers.TrueEqualsList(obj.answers) &&
body.TrueEqualsString(obj.body) &&
body_markdown.TrueEqualsString(obj.body_markdown) &&
bounty_amount.TrueEquals(obj.bounty_amount) &&
bounty_closes_date.TrueEquals(obj.bounty_closes_date) &&
close_vote_count.TrueEquals(obj.close_vote_count) &&
closed_date.TrueEquals(obj.closed_date) &&
closed_details.TrueEquals(obj.closed_details) &&
closed_reason.TrueEqualsString(obj.closed_reason) &&
comment_count.TrueEquals(obj.comment_count) &&
comments.TrueEqualsList(obj.comments) &&
community_owned_date.TrueEquals(obj.community_owned_date) &&
creation_date.TrueEquals(obj.creation_date) &&
delete_vote_count.TrueEquals(obj.delete_vote_count) &&
down_vote_count.TrueEquals(obj.down_vote_count) &&
downvoted.TrueEquals(obj.downvoted) &&
favorite_count.TrueEquals(obj.favorite_count) &&
favorited.TrueEquals(obj.favorited) &&
is_answered.TrueEquals(obj.is_answered) &&
last_activity_date.TrueEquals(obj.last_activity_date) &&
last_edit_date.TrueEquals(obj.last_edit_date) &&
last_editor.TrueEquals(obj.last_editor) &&
link.TrueEqualsString(obj.link) &&
locked_date.TrueEquals(obj.locked_date) &&
migrated_from.TrueEquals(obj.migrated_from) &&
migrated_to.TrueEquals(obj.migrated_to) &&
notice.TrueEquals(obj.notice) &&
owner.TrueEquals(obj.owner) &&
protected_date.TrueEquals(obj.protected_date) &&
question_id.TrueEquals(obj.question_id) &&
reopen_vote_count.TrueEquals(obj.reopen_vote_count) &&
score.TrueEquals(obj.score) &&
share_link.TrueEqualsString(obj.share_link) &&
tags.TrueEqualsString(obj.tags) &&
title.TrueEqualsString(obj.title) &&
up_vote_count.TrueEquals(obj.up_vote_count) &&
upvoted.TrueEquals(obj.upvoted) &&
view_count.TrueEquals(obj.view_count);
}
public bool EqualsDynamic(dynamic obj)
{
return
accepted_answer_id.TrueEquals((int?) obj.accepted_answer_id) &&
answer_count.TrueEquals((int?) obj.answer_count) &&
answers.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.answers) &&
body.TrueEqualsString((string) obj.body) &&
body_markdown.TrueEqualsString((string) obj.body_markdown) &&
bounty_amount.TrueEquals((int?) obj.bounty_amount) &&
bounty_closes_date.TrueEquals((DateTime?) obj.bounty_closes_date) &&
close_vote_count.TrueEquals((int?) obj.close_vote_count) &&
closed_date.TrueEquals((DateTime?) obj.closed_date) &&
(closed_details == null && obj.closed_details == null ||
closed_details.EqualsDynamic(obj.closed_details)) &&
closed_reason.TrueEqualsString((string) obj.closed_reason) &&
comment_count.TrueEquals((int?) obj.comment_count) &&
comments.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.comments) &&
community_owned_date.TrueEquals((DateTime?) obj.community_owned_date) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
delete_vote_count.TrueEquals((int?) obj.delete_vote_count) &&
down_vote_count.TrueEquals((int?) obj.down_vote_count) &&
downvoted.TrueEquals((bool?) obj.downvoted) &&
favorite_count.TrueEquals((int?) obj.favorite_count) &&
favorited.TrueEquals((bool?) obj.favorited) &&
is_answered.TrueEquals((bool?) obj.is_answered) &&
last_activity_date.TrueEquals((DateTime?) obj.last_activity_date) &&
last_edit_date.TrueEquals((DateTime?) obj.last_edit_date) &&
(last_editor == null && obj.last_editor == null || last_editor.EqualsDynamic(obj.last_editor)) &&
link.TrueEqualsString((string) obj.link) &&
locked_date.TrueEquals((DateTime?) obj.locked_date) &&
(migrated_from == null && obj.migrated_from == null ||
migrated_from.EqualsDynamic(obj.migrated_from)) &&
(migrated_to == null && obj.migrated_to == null || migrated_to.EqualsDynamic(obj.migrated_to)) &&
(notice == null && obj.notice == null || notice.EqualsDynamic(obj.notice)) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
protected_date.TrueEquals((DateTime?) obj.protected_date) &&
question_id.TrueEquals((int?) obj.question_id) &&
reopen_vote_count.TrueEquals((int?) obj.reopen_vote_count) &&
score.TrueEquals((int?) obj.score) &&
share_link.TrueEqualsString((string) obj.share_link) &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title.TrueEqualsString((string) obj.title) &&
up_vote_count.TrueEquals((int?) obj.up_vote_count) &&
upvoted.TrueEquals((bool?) obj.upvoted) &&
view_count.TrueEquals((int?) obj.view_count);
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class ClosedDetails : IGenericEquality<ClosedDetails>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public bool? on_hold { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string reason { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string description { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public List<ShallowUser> by_users { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public List<OriginalQuestion> original_questions { get; set; }
public bool Equals(ClosedDetails obj)
{
return
by_users.TrueEqualsList(obj.by_users) &&
description.TrueEqualsString(obj.description) &&
on_hold.TrueEquals(obj.on_hold) &&
original_questions.TrueEqualsList(obj.original_questions) &&
reason.TrueEqualsString(obj.reason);
}
public bool EqualsDynamic(dynamic obj)
{
var oq = obj.original_questions;
var oqI = (IEnumerable<dynamic>) oq;
return
by_users.TrueEqualsListDynamic((IEnumerable<dynamic>) obj.by_users) &&
description.TrueEqualsString((string) obj.description) &&
on_hold.TrueEquals((bool?) obj.on_hold) &&
//this.original_questions.TrueEqualsListDynamic((IEnumerable<dynamic>)obj.original_questions) &&
original_questions.TrueEqualsListDynamic(oqI) &&
reason.TrueEqualsString((string) obj.reason);
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class OriginalQuestion : IGenericEquality<OriginalQuestion>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? accepted_answer_id { get; set; }
public bool Equals(OriginalQuestion obj)
{
return
accepted_answer_id.TrueEquals(obj.accepted_answer_id) &&
answer_count.TrueEquals(obj.answer_count) &&
question_id.TrueEquals(obj.question_id) &&
title.TrueEqualsString(obj.title);
}
public bool EqualsDynamic(dynamic obj)
{
return
accepted_answer_id.TrueEquals((int?) obj.accepted_answer_id) &&
answer_count.TrueEquals((int?) obj.answer_count) &&
question_id.TrueEquals((int?) obj.question_id) &&
title.TrueEqualsString((string) obj.title);
}
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Notice : IGenericEquality<Notice>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? owner_user_id { get; set; }
public bool Equals(Notice obj)
{
return
body.TrueEqualsString(obj.body) &&
creation_date.TrueEquals(obj.creation_date) &&
owner_user_id.TrueEquals(obj.owner_user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
owner_user_id.TrueEquals((int?) obj.owner_user_id);
}
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class MigrationInfo : IGenericEquality<MigrationInfo>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public Info.Site other_site { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? on_date { get; set; }
public bool Equals(MigrationInfo obj)
{
return
on_date.TrueEquals(obj.on_date) &&
other_site.TrueEquals(obj.other_site) &&
question_id.TrueEquals(obj.question_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
on_date.TrueEquals((DateTime?) obj.on_date) &&
(other_site == null && obj.other_site == null || other_site.EqualsDynamic(obj.other_site)) &&
question_id.TrueEquals((int?) obj.question_id);
}
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum QuestionTimelineAction : byte
{
question = 1,
answer = 2,
comment = 3,
unaccepted_answer = 4,
accepted_answer = 5,
vote_aggregate = 6,
revision = 7,
post_state_changed = 8
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class QuestionTimeline : IGenericEquality<QuestionTimeline>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public QuestionTimelineAction? timeline_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? comment_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string revision_guid { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? up_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? down_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public ShallowUser user { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public ShallowUser owner { get; set; }
public bool Equals(QuestionTimeline obj)
{
return
comment_id.TrueEquals(obj.comment_id) &&
creation_date.TrueEquals(obj.creation_date) &&
down_vote_count.TrueEquals(obj.down_vote_count) &&
owner.TrueEquals(obj.owner) &&
post_id.TrueEquals(obj.post_id) &&
question_id.TrueEquals(obj.question_id) &&
revision_guid.TrueEqualsString(obj.revision_guid) &&
timeline_type.TrueEquals(obj.timeline_type) &&
up_vote_count.TrueEquals(obj.up_vote_count) &&
user.TrueEquals(obj.user);
}
public bool EqualsDynamic(dynamic obj)
{
return
comment_id.TrueEquals((int?) obj.comment_id) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
down_vote_count.TrueEquals((int?) obj.down_vote_count) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
post_id.TrueEquals((int?) obj.post_id) &&
question_id.TrueEquals((int?) obj.question_id) &&
revision_guid.TrueEqualsString((string) obj.revision_guid) &&
timeline_type.TrueEquals((QuestionTimelineAction?) obj.timeline_type) &&
up_vote_count.TrueEquals((int?) obj.up_vote_count) &&
(user == null && obj.user == null || user.EqualsDynamic(obj.user));
}
}
}

Просмотреть файл

@ -0,0 +1,72 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum VoteType : byte
{
up_votes = 2,
down_votes = 3,
spam = 12,
accepts = 1,
bounties_won = 9,
bounties_offered = 8,
suggested_edits = 16
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Reputation : IGenericEquality<Reputation>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public VoteType? vote_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? reputation_change { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public DateTime? on_date { get; set; }
public bool Equals(Reputation obj)
{
return
link.TrueEqualsString(obj.link) &&
on_date.TrueEquals(obj.on_date) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
reputation_change.TrueEquals(obj.reputation_change) &&
title.TrueEqualsString(obj.title) &&
user_id.TrueEquals(obj.user_id) &&
vote_type.TrueEquals(obj.vote_type);
}
public bool EqualsDynamic(dynamic obj)
{
return
link.TrueEqualsString((string) obj.link) &&
on_date.TrueEquals((DateTime?) obj.on_date) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
reputation_change.TrueEquals((int?) obj.reputation_change) &&
title.TrueEqualsString((string) obj.title) &&
user_id.TrueEquals((int?) obj.user_id) &&
vote_type.TrueEquals((VoteType?) obj.vote_type);
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class ReputationHistory : IGenericEquality<ReputationHistory>
{
public enum ReputationHistoryType : byte
{
asker_accepts_answer = 1,
asker_unaccept_answer = 2,
answer_accepted = 3,
answer_unaccepted = 4,
voter_downvotes = 5,
voter_undownvotes = 6,
post_downvoted = 7,
post_undownvoted = 8,
post_upvoted = 9,
post_unupvoted = 10,
suggested_edit_approval_received = 11,
post_flagged_as_spam = 12,
post_flagged_as_offensive = 13,
bounty_given = 14,
bounty_earned = 15,
bounty_cancelled = 16,
post_deleted = 17,
post_undeleted = 18,
association_bonus = 19,
arbitrary_reputation_change = 20,
vote_fraud_reversal = 21,
post_migrated = 22,
user_deleted = 23
}
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? reputation_change { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public ReputationHistoryType? reputation_history_type { get; set; }
public bool Equals(ReputationHistory obj)
{
return
creation_date.TrueEquals(obj.creation_date) &&
post_id.TrueEquals(obj.post_id) &&
reputation_change.TrueEquals(obj.reputation_change) &&
reputation_history_type.TrueEquals(obj.reputation_history_type) &&
user_id.TrueEquals(obj.user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
post_id.TrueEquals((int?) obj.post_id) &&
reputation_change.TrueEquals((int?) obj.reputation_change) &&
reputation_history_type.TrueEquals((ReputationHistoryType?) obj.reputation_history_type) &&
user_id.TrueEquals((int?) obj.user_id);
}
}
}

Просмотреть файл

@ -0,0 +1,108 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
public enum RevisionType : byte
{
single_user = 1,
vote_based = 2
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Revision : IGenericEquality<Revision>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string revision_guid { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? revision_number { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public RevisionType? revision_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string comment { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public bool? is_rollback { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public string last_body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string last_title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public List<string> last_tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public bool? set_community_wiki { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public ShallowUser user { get; set; }
public bool Equals(Revision obj)
{
return
body.TrueEqualsString(obj.body) &&
comment.TrueEqualsString(obj.comment) &&
creation_date.TrueEquals(obj.creation_date) &&
is_rollback.TrueEquals(obj.is_rollback) &&
last_body.TrueEqualsString(obj.last_body) &&
last_tags.TrueEqualsString(obj.last_tags) &&
last_title.TrueEqualsString(obj.last_title) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
revision_guid.TrueEqualsString(obj.revision_guid) &&
revision_number.TrueEquals(obj.revision_number) &&
revision_type.TrueEquals(obj.revision_type) &&
set_community_wiki.TrueEquals(obj.set_community_wiki) &&
tags.TrueEqualsString(obj.tags) &&
title.TrueEqualsString(obj.title) &&
user.TrueEquals(obj.user);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
comment.TrueEqualsString((string) obj.comment) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
is_rollback.TrueEquals((bool?) obj.is_rollback) &&
last_body.TrueEqualsString((string) obj.last_body) &&
last_tags.TrueEqualsString((IEnumerable<string>) obj.last_tags) &&
last_title.TrueEqualsString((string) obj.last_title) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
revision_guid.TrueEqualsString((string) obj.revision_guid) &&
revision_number.TrueEquals((int?) obj.revision_number) &&
revision_type.TrueEquals((RevisionType?) obj.revision_type) &&
set_community_wiki.TrueEquals((bool?) obj.set_community_wiki) &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title.TrueEqualsString((string) obj.title) &&
(user == null && obj.user == null || user.EqualsDynamic(obj.user));
}
}
}

Просмотреть файл

@ -0,0 +1,119 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
public enum SearchExcerptItemType : byte
{
question = 1,
answer = 2
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class SearchExcerpt : IGenericEquality<SearchExcerpt>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string excerpt { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? community_owned_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public DateTime? locked_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public DateTime? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public ShallowUser owner { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public ShallowUser last_activity_user { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public SearchExcerptItemType? item_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public int? question_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public bool? is_answered { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public DateTime? closed_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public int? answer_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public bool? is_accepted { get; set; }
public bool Equals(SearchExcerpt obj)
{
return
answer_count.TrueEquals(obj.answer_count) &&
answer_id.TrueEquals(obj.answer_id) &&
body.TrueEqualsString(obj.body) &&
closed_date.TrueEquals(obj.closed_date) &&
community_owned_date.TrueEquals(obj.community_owned_date) &&
creation_date.TrueEquals(obj.creation_date) &&
excerpt.TrueEqualsString(obj.excerpt) &&
is_accepted.TrueEquals(obj.is_accepted) &&
is_answered.TrueEquals(obj.is_answered) &&
item_type.TrueEquals(obj.item_type) &&
last_activity_date.TrueEquals(obj.last_activity_date) &&
last_activity_user.TrueEquals(obj.last_activity_user) &&
locked_date.TrueEquals(obj.locked_date) &&
owner.TrueEquals(obj.owner) &&
question_id.TrueEquals(obj.question_id) &&
score.TrueEquals(obj.score) &&
tags.TrueEqualsString(obj.tags) &&
title.TrueEqualsString(obj.title);
}
public bool EqualsDynamic(dynamic obj)
{
return
answer_count.TrueEquals((int?) obj.answer_count) &&
answer_id.TrueEquals((int?) obj.answer_id) &&
body.TrueEqualsString((string) obj.body) &&
closed_date.TrueEquals((DateTime?) obj.closed_date) &&
community_owned_date.TrueEquals((DateTime?) obj.community_owned_date) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
excerpt.TrueEqualsString((string) obj.excerpt) &&
is_accepted.TrueEquals((bool?) obj.is_accepted) &&
is_answered.TrueEquals((bool?) obj.is_answered) &&
item_type.TrueEquals((SearchExcerptItemType?) obj.item_type) &&
last_activity_date.TrueEquals((DateTime?) obj.last_activity_date) &&
(last_activity_user == null && obj.last_activity_user == null ||
last_activity_user.EqualsDynamic(obj.last_activity_user)) &&
locked_date.TrueEquals((DateTime?) obj.locked_date) &&
(owner == null && obj.owner == null || owner.EqualsDynamic(obj.owner)) &&
question_id.TrueEquals((int?) obj.question_id) &&
score.TrueEquals((int?) obj.score) &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title.TrueEqualsString((string) obj.title);
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
public enum UserType : byte
{
unregistered = 2,
registered = 3,
moderator = 4,
does_not_exist = 255
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class ShallowUser : IGenericEquality<ShallowUser>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string display_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? reputation { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public UserType? user_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string profile_image { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? accept_rate { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public User.BadgeCount badge_counts { get; set; }
public bool Equals(ShallowUser obj)
{
return
accept_rate.TrueEquals(obj.accept_rate) &&
badge_counts.TrueEquals(obj.badge_counts) &&
display_name.TrueEqualsString(obj.display_name) &&
link.TrueEqualsString(obj.link) &&
profile_image.TrueEqualsString(obj.profile_image) &&
reputation.TrueEquals(obj.reputation) &&
user_id.TrueEquals(obj.user_id) &&
user_type.TrueEquals(obj.user_type);
}
public bool EqualsDynamic(dynamic obj)
{
return
accept_rate.TrueEquals((int?) obj.accept_rate) &&
(badge_counts == null && obj.badge_counts == null || badge_counts.EqualsDynamic(obj.badge_counts)) &&
display_name.TrueEqualsString((string) obj.display_name) &&
link.TrueEqualsString((string) obj.link) &&
profile_image.TrueEqualsString((string) obj.profile_image) &&
reputation.TrueEquals((int?) obj.reputation) &&
user_id.TrueEquals((int?) obj.user_id) &&
user_type.TrueEquals((UserType?) obj.user_type);
}
}
}

Просмотреть файл

@ -0,0 +1,78 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class SuggestedEdit : IGenericEquality<SuggestedEdit>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? suggested_edit_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public List<string> tags { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public string comment { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public DateTime? approval_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public DateTime? rejection_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public ShallowUser proposing_user { get; set; }
public bool Equals(SuggestedEdit obj)
{
return
approval_date.TrueEquals(obj.approval_date) &&
body.TrueEqualsString(obj.body) &&
comment.TrueEqualsString(obj.comment) &&
creation_date.TrueEquals(obj.creation_date) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
proposing_user.TrueEquals(obj.proposing_user) &&
rejection_date.TrueEquals(obj.rejection_date) &&
suggested_edit_id.TrueEquals(obj.suggested_edit_id) &&
tags.TrueEqualsString(obj.tags) &&
title.TrueEqualsString(obj.title);
}
public bool EqualsDynamic(dynamic obj)
{
return
approval_date.TrueEquals((DateTime?) obj.approval_date) &&
body.TrueEqualsString((string) obj.body) &&
comment.TrueEqualsString((string) obj.comment) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
(proposing_user == null && obj.proposing_user == null ||
proposing_user.EqualsDynamic(obj.proposing_user)) &&
rejection_date.TrueEquals((DateTime?) obj.rejection_date) &&
suggested_edit_id.TrueEquals((int?) obj.suggested_edit_id) &&
tags.TrueEqualsString((IEnumerable<string>) obj.tags) &&
title.TrueEqualsString((string) obj.title);
}
}
}

Просмотреть файл

@ -0,0 +1,62 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using System.Collections.Generic;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class Tag : IGenericEquality<Tag>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public bool? is_required { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public bool? is_moderator_only { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public bool? has_synonyms { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public DateTime? last_activity_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public List<string> synonyms { get; set; }
public bool Equals(Tag obj)
{
return
count.TrueEquals(obj.count) &&
has_synonyms.TrueEquals(obj.has_synonyms) &&
is_moderator_only.TrueEquals(obj.is_moderator_only) &&
is_required.TrueEquals(obj.is_required) &&
last_activity_date.TrueEquals(obj.last_activity_date) &&
name.TrueEqualsString(obj.name) &&
synonyms.TrueEqualsString(obj.synonyms) &&
user_id.TrueEquals(obj.user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
count.TrueEquals((int?) obj.count) &&
has_synonyms.TrueEquals((bool?) obj.has_synonyms) &&
is_moderator_only.TrueEquals((bool?) obj.is_moderator_only) &&
is_required.TrueEquals((bool?) obj.is_required) &&
last_activity_date.TrueEquals((DateTime?) obj.last_activity_date) &&
name.TrueEqualsString((string) obj.name) &&
synonyms.TrueEqualsString((IEnumerable<string>) obj.synonyms) &&
user_id.TrueEquals((int?) obj.user_id);
}
}
}

Просмотреть файл

@ -0,0 +1,35 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class TagScore : IGenericEquality<TagScore>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public ShallowUser user { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? post_count { get; set; }
public bool Equals(TagScore obj)
{
return
post_count.TrueEquals(obj.post_count) &&
score.TrueEquals(obj.score) &&
user.TrueEquals(obj.user);
}
public bool EqualsDynamic(dynamic obj)
{
return
post_count.TrueEquals((int?) obj.post_count) &&
score.TrueEquals((int?) obj.score) &&
(user == null && obj.user == null || user.EqualsDynamic(obj.user));
}
}
}

Просмотреть файл

@ -0,0 +1,46 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class TagSynonym : IGenericEquality<TagSynonym>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string from_tag { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string to_tag { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? applied_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public DateTime? last_applied_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? creation_date { get; set; }
public bool Equals(TagSynonym obj)
{
return
applied_count.TrueEquals(obj.applied_count) &&
creation_date.TrueEquals(obj.creation_date) &&
from_tag.TrueEqualsString(obj.from_tag) &&
last_applied_date.TrueEquals(obj.last_applied_date) &&
to_tag.TrueEqualsString(obj.to_tag);
}
public bool EqualsDynamic(dynamic obj)
{
return
applied_count.TrueEquals((int?) obj.applied_count) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
from_tag.TrueEqualsString((string) obj.from_tag) &&
last_applied_date.TrueEquals((DateTime?) obj.last_applied_date) &&
to_tag.TrueEqualsString((string) obj.to_tag);
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class TagWiki : IGenericEquality<TagWiki>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string tag_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string body { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public string excerpt { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public DateTime? body_last_edit_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public DateTime? excerpt_last_edit_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public ShallowUser last_body_editor { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public ShallowUser last_excerpt_editor { get; set; }
public bool Equals(TagWiki obj)
{
return
body.TrueEqualsString(obj.body) &&
body_last_edit_date.TrueEquals(obj.body_last_edit_date) &&
excerpt.TrueEqualsString(obj.excerpt) &&
excerpt_last_edit_date.TrueEquals(obj.excerpt_last_edit_date) &&
last_body_editor.TrueEquals(obj.last_body_editor) &&
last_excerpt_editor.TrueEquals(obj.last_excerpt_editor) &&
tag_name.TrueEqualsString(obj.tag_name);
}
public bool EqualsDynamic(dynamic obj)
{
return
body.TrueEqualsString((string) obj.body) &&
body_last_edit_date.TrueEquals((DateTime?) obj.body_last_edit_date) &&
excerpt.TrueEqualsString((string) obj.excerpt) &&
excerpt_last_edit_date.TrueEquals((DateTime?) obj.excerpt_last_edit_date) &&
(last_body_editor == null && obj.last_body_editor == null ||
last_body_editor.EqualsDynamic(obj.last_body_editor)) &&
(last_excerpt_editor == null && obj.last_excerpt_editor == null ||
last_excerpt_editor.EqualsDynamic(obj.last_excerpt_editor)) &&
tag_name.TrueEqualsString((string) obj.tag_name);
}
}
}

Просмотреть файл

@ -0,0 +1,50 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class TopTag : IGenericEquality<TopTag>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public string tag_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? question_score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? question_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? answer_score { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? user_id { get; set; }
public bool Equals(TopTag obj)
{
return
answer_count.TrueEquals(obj.answer_count) &&
answer_score.TrueEquals(obj.answer_score) &&
question_count.TrueEquals(obj.question_count) &&
question_score.TrueEquals(obj.question_score) &&
tag_name.TrueEqualsString(obj.tag_name) &&
user_id.TrueEquals(obj.user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
answer_count.TrueEquals((int?) obj.answer_count) &&
answer_score.TrueEquals((int?) obj.answer_score) &&
question_count.TrueEquals((int?) obj.question_count) &&
question_score.TrueEquals((int?) obj.question_score) &&
tag_name.TrueEqualsString((string) obj.tag_name) &&
user_id.TrueEquals((int?) obj.user_id);
}
}
}

Просмотреть файл

@ -0,0 +1,190 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class User : IGenericEquality<User>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public UserType? user_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public string display_name { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public string profile_image { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? reputation { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? reputation_change_day { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public int? reputation_change_week { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public int? reputation_change_month { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public int? reputation_change_quarter { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public int? reputation_change_year { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(12), oldmsgpack::MessagePack.Key(12 - 1), newmsgpack::MessagePack.Key(12 - 1)]
public int? age { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(13), oldmsgpack::MessagePack.Key(13 - 1), newmsgpack::MessagePack.Key(13 - 1)]
public DateTime? last_access_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(14), oldmsgpack::MessagePack.Key(14 - 1), newmsgpack::MessagePack.Key(14 - 1)]
public DateTime? last_modified_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(15), oldmsgpack::MessagePack.Key(15 - 1), newmsgpack::MessagePack.Key(15 - 1)]
public bool? is_employee { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(16), oldmsgpack::MessagePack.Key(16 - 1), newmsgpack::MessagePack.Key(16 - 1)]
public string link { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(17), oldmsgpack::MessagePack.Key(17 - 1), newmsgpack::MessagePack.Key(17 - 1)]
public string website_url { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(18), oldmsgpack::MessagePack.Key(18 - 1), newmsgpack::MessagePack.Key(18 - 1)]
public string location { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(19), oldmsgpack::MessagePack.Key(19 - 1), newmsgpack::MessagePack.Key(19 - 1)]
public int? account_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(20), oldmsgpack::MessagePack.Key(20 - 1), newmsgpack::MessagePack.Key(20 - 1)]
public DateTime? timed_penalty_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(21), oldmsgpack::MessagePack.Key(21 - 1), newmsgpack::MessagePack.Key(21 - 1)]
public BadgeCount badge_counts { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(22), oldmsgpack::MessagePack.Key(22 - 1), newmsgpack::MessagePack.Key(22 - 1)]
public int? question_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(23), oldmsgpack::MessagePack.Key(23 - 1), newmsgpack::MessagePack.Key(23 - 1)]
public int? answer_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(24), oldmsgpack::MessagePack.Key(24 - 1), newmsgpack::MessagePack.Key(24 - 1)]
public int? up_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(25), oldmsgpack::MessagePack.Key(25 - 1), newmsgpack::MessagePack.Key(25 - 1)]
public int? down_vote_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(26), oldmsgpack::MessagePack.Key(26 - 1), newmsgpack::MessagePack.Key(26 - 1)]
public string about_me { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(27), oldmsgpack::MessagePack.Key(27 - 1), newmsgpack::MessagePack.Key(27 - 1)]
public int? view_count { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(28), oldmsgpack::MessagePack.Key(28 - 1), newmsgpack::MessagePack.Key(28 - 1)]
public int? accept_rate { get; set; }
public bool Equals(User obj)
{
return
about_me.TrueEqualsString(obj.about_me) &&
accept_rate.TrueEquals(obj.accept_rate) &&
account_id.TrueEquals(obj.account_id) &&
age.TrueEquals(obj.age) &&
answer_count.TrueEquals(obj.answer_count) &&
badge_counts.TrueEquals(obj.badge_counts) &&
creation_date.TrueEquals(obj.creation_date) &&
display_name.TrueEqualsString(obj.display_name) &&
down_vote_count.TrueEquals(obj.down_vote_count) &&
is_employee.TrueEquals(obj.is_employee) &&
last_access_date.TrueEquals(obj.last_access_date) &&
last_modified_date.TrueEquals(obj.last_modified_date) &&
link.TrueEqualsString(obj.link) &&
location.TrueEqualsString(obj.location) &&
profile_image.TrueEqualsString(obj.profile_image) &&
question_count.TrueEquals(obj.question_count) &&
reputation.TrueEquals(obj.reputation) &&
reputation_change_day.TrueEquals(obj.reputation_change_day) &&
reputation_change_month.TrueEquals(obj.reputation_change_month) &&
reputation_change_quarter.TrueEquals(obj.reputation_change_quarter) &&
reputation_change_week.TrueEquals(obj.reputation_change_week) &&
reputation_change_year.TrueEquals(obj.reputation_change_year) &&
timed_penalty_date.TrueEquals(obj.timed_penalty_date) &&
up_vote_count.TrueEquals(obj.up_vote_count) &&
user_id.TrueEquals(obj.user_id) &&
user_type.TrueEquals(obj.user_type) &&
view_count.TrueEquals(obj.view_count) &&
website_url.TrueEqualsString(obj.website_url);
}
public bool EqualsDynamic(dynamic obj)
{
return
about_me.TrueEqualsString((string) obj.about_me) &&
accept_rate.TrueEquals((int?) obj.accept_rate) &&
account_id.TrueEquals((int?) obj.account_id) &&
age.TrueEquals((int?) obj.age) &&
answer_count.TrueEquals((int?) obj.answer_count) &&
(badge_counts == null && obj.badge_counts == null || badge_counts.EqualsDynamic(obj.badge_counts)) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
display_name.TrueEqualsString((string) obj.display_name) &&
down_vote_count.TrueEquals((int?) obj.down_vote_count) &&
is_employee.TrueEquals((bool?) obj.is_employee) &&
last_access_date.TrueEquals((DateTime?) obj.last_access_date) &&
last_modified_date.TrueEquals((DateTime?) obj.last_modified_date) &&
link.TrueEqualsString((string) obj.link) &&
location.TrueEqualsString((string) obj.location) &&
profile_image.TrueEqualsString((string) obj.profile_image) &&
question_count.TrueEquals((int?) obj.question_count) &&
reputation.TrueEquals((int?) obj.reputation) &&
reputation_change_day.TrueEquals((int?) obj.reputation_change_day) &&
reputation_change_month.TrueEquals((int?) obj.reputation_change_month) &&
reputation_change_quarter.TrueEquals((int?) obj.reputation_change_quarter) &&
reputation_change_week.TrueEquals((int?) obj.reputation_change_week) &&
reputation_change_year.TrueEquals((int?) obj.reputation_change_year) &&
timed_penalty_date.TrueEquals((DateTime?) obj.timed_penalty_date) &&
up_vote_count.TrueEquals((int?) obj.up_vote_count) &&
user_id.TrueEquals((int?) obj.user_id) &&
user_type.TrueEquals((UserType?) obj.user_type) &&
view_count.TrueEquals((int?) obj.view_count) &&
website_url.TrueEqualsString((string) obj.website_url);
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class BadgeCount : IGenericEquality<BadgeCount>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? gold { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public int? silver { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public int? bronze { get; set; }
public bool Equals(BadgeCount obj)
{
return
bronze.TrueEquals(obj.bronze) &&
silver.TrueEquals(obj.silver) &&
gold.TrueEquals(obj.gold);
}
public bool EqualsDynamic(dynamic obj)
{
return
bronze.TrueEquals((int?) obj.bronze) &&
silver.TrueEquals((int?) obj.silver) &&
gold.TrueEquals((int?) obj.gold);
}
}
}
}

Просмотреть файл

@ -0,0 +1,88 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using System;
using ProtoBuf;
namespace Benchmark.Models
{
public enum UserTimelineType : byte
{
commented = 1,
asked = 2,
answered = 3,
badge = 4,
revision = 5,
accepted = 6,
reviewed = 7,
suggested = 8
}
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class UserTimeline : IGenericEquality<UserTimeline>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public DateTime? creation_date { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public PostType? post_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public UserTimelineType? timeline_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public int? post_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? comment_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? suggested_edit_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(8), oldmsgpack::MessagePack.Key(8 - 1), newmsgpack::MessagePack.Key(8 - 1)]
public int? badge_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(9), oldmsgpack::MessagePack.Key(9 - 1), newmsgpack::MessagePack.Key(9 - 1)]
public string title { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(10), oldmsgpack::MessagePack.Key(10 - 1), newmsgpack::MessagePack.Key(10 - 1)]
public string detail { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(11), oldmsgpack::MessagePack.Key(11 - 1), newmsgpack::MessagePack.Key(11 - 1)]
public string link { get; set; }
public bool Equals(UserTimeline obj)
{
return
badge_id.TrueEquals(obj.badge_id) &&
comment_id.TrueEquals(obj.comment_id) &&
creation_date.TrueEquals(obj.creation_date) &&
detail.TrueEqualsString(obj.detail) &&
link.TrueEqualsString(obj.link) &&
post_id.TrueEquals(obj.post_id) &&
post_type.TrueEquals(obj.post_type) &&
suggested_edit_id.TrueEquals(obj.suggested_edit_id) &&
timeline_type.TrueEquals(obj.timeline_type) &&
title.TrueEqualsString(obj.title) &&
user_id.TrueEquals(obj.user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
badge_id.TrueEquals((int?) obj.badge_id) &&
comment_id.TrueEquals((int?) obj.comment_id) &&
creation_date.TrueEquals((DateTime?) obj.creation_date) &&
detail.TrueEqualsString((string) obj.detail) &&
link.TrueEqualsString((string) obj.link) &&
post_id.TrueEquals((int?) obj.post_id) &&
post_type.TrueEquals((PostType?) obj.post_type) &&
suggested_edit_id.TrueEquals((int?) obj.suggested_edit_id) &&
timeline_type.TrueEquals((UserTimelineType?) obj.timeline_type) &&
title.TrueEqualsString((string) obj.title) &&
user_id.TrueEquals((int?) obj.user_id);
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using ProtoBuf;
namespace Benchmark.Models
{
[ProtoContract, System.Serializable, System.Runtime.Serialization.DataContract, oldmsgpack::MessagePack.MessagePackObject, newmsgpack::MessagePack.MessagePackObject]
public class WritePermission : IGenericEquality<WritePermission>
{
[System.Runtime.Serialization.DataMember(), ProtoMember(1), oldmsgpack::MessagePack.Key(1 - 1), newmsgpack::MessagePack.Key(1 - 1)]
public int? user_id { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(2), oldmsgpack::MessagePack.Key(2 - 1), newmsgpack::MessagePack.Key(2 - 1)]
public string object_type { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(3), oldmsgpack::MessagePack.Key(3 - 1), newmsgpack::MessagePack.Key(3 - 1)]
public bool? can_add { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(4), oldmsgpack::MessagePack.Key(4 - 1), newmsgpack::MessagePack.Key(4 - 1)]
public bool? can_edit { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(5), oldmsgpack::MessagePack.Key(5 - 1), newmsgpack::MessagePack.Key(5 - 1)]
public bool? can_delete { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(6), oldmsgpack::MessagePack.Key(6 - 1), newmsgpack::MessagePack.Key(6 - 1)]
public int? max_daily_actions { get; set; }
[System.Runtime.Serialization.DataMember(), ProtoMember(7), oldmsgpack::MessagePack.Key(7 - 1), newmsgpack::MessagePack.Key(7 - 1)]
public int? min_seconds_between_actions { get; set; }
public bool Equals(WritePermission obj)
{
return
can_add.TrueEquals(obj.can_add) &&
can_delete.TrueEquals(obj.can_delete) &&
can_edit.TrueEquals(obj.can_edit) &&
max_daily_actions.TrueEquals(obj.max_daily_actions) &&
min_seconds_between_actions.TrueEquals(obj.min_seconds_between_actions) &&
object_type.TrueEqualsString(obj.object_type) &&
user_id.TrueEquals(obj.user_id);
}
public bool EqualsDynamic(dynamic obj)
{
return
can_add.TrueEquals((bool?) obj.can_add) &&
can_delete.TrueEquals((bool?) obj.can_delete) &&
can_edit.TrueEquals((bool?) obj.can_edit) &&
max_daily_actions.TrueEquals((int?) obj.max_daily_actions) &&
min_seconds_between_actions.TrueEquals((int?) obj.min_seconds_between_actions) &&
object_type.TrueEqualsString((string) obj.object_type) &&
user_id.TrueEquals((int?) obj.user_id);
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
using Benchmark;
using Benchmark.Models;
using BenchmarkDotNet.Running;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
//BenchmarkRunner.Run<ShortRun_AllSerializerBenchmark_BytesInOut>();
}
}
}

Просмотреть файл

@ -0,0 +1,955 @@
namespace Benchmark
{
using Benchmark.Fixture;
using Benchmark.Models;
using Benchmark.Serializers;
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
[Config(typeof(BenchmarkConfig))]
public class AllSerializerBenchmark_BytesInOut
{
[ParamsSource(nameof(Serializers))]
public SerializerBase Serializer;
// Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:)
public IEnumerable<SerializerBase> Serializers => new SerializerBase[]
{
new MessagePack_v1(),
new MessagePack_v2(),
new MessagePackLz4_v1(),
new MessagePackLz4_v2(),
new ProtobufNet(),
new JsonNet(),
new BinaryFormatter_(),
new DataContract_(),
new Hyperion_(),
new Jil_(),
new SpanJson_(),
new Utf8Json_(),
new MsgPackCli(),
new FsPickler_(),
new Ceras_(),
};
protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture();
// primitives
protected static readonly sbyte SByteInput = ExpressionTreeFixture.Create<sbyte>();
protected static readonly short ShortInput = ExpressionTreeFixture.Create<short>();
protected static readonly int IntInput = ExpressionTreeFixture.Create<int>();
protected static readonly long LongInput = ExpressionTreeFixture.Create<long>();
protected static readonly byte ByteInput = ExpressionTreeFixture.Create<byte>();
protected static readonly ushort UShortInput = ExpressionTreeFixture.Create<ushort>();
protected static readonly uint UIntInput = ExpressionTreeFixture.Create<uint>();
protected static readonly ulong ULongInput = ExpressionTreeFixture.Create<ulong>();
protected static readonly bool BoolInput = ExpressionTreeFixture.Create<bool>();
protected static readonly string StringInput = ExpressionTreeFixture.Create<string>();
protected static readonly char CharInput = ExpressionTreeFixture.Create<char>();
protected static readonly DateTime DateTimeInput = ExpressionTreeFixture.Create<DateTime>();
protected static readonly Guid GuidInput = ExpressionTreeFixture.Create<Guid>();
protected static readonly byte[] BytesInput = ExpressionTreeFixture.Create<byte[]>();
// models
protected static readonly Benchmark.Models.AccessToken AccessTokenInput = ExpressionTreeFixture.Create<Benchmark.Models.AccessToken>();
protected static readonly Benchmark.Models.AccountMerge AccountMergeInput = ExpressionTreeFixture.Create<Benchmark.Models.AccountMerge>();
protected static readonly Benchmark.Models.Answer AnswerInput = ExpressionTreeFixture.Create<Benchmark.Models.Answer>();
protected static readonly Benchmark.Models.Badge BadgeInput = ExpressionTreeFixture.Create<Benchmark.Models.Badge>();
protected static readonly Benchmark.Models.Comment CommentInput = ExpressionTreeFixture.Create<Benchmark.Models.Comment>();
protected static readonly Benchmark.Models.Error ErrorInput = ExpressionTreeFixture.Create<Benchmark.Models.Error>();
protected static readonly Benchmark.Models.Event EventInput = ExpressionTreeFixture.Create<Benchmark.Models.Event>();
protected static readonly Benchmark.Models.MobileFeed MobileFeedInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileFeed>();
protected static readonly Benchmark.Models.MobileQuestion MobileQuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileQuestion>();
protected static readonly Benchmark.Models.MobileRepChange MobileRepChangeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileRepChange>();
protected static readonly Benchmark.Models.MobileInboxItem MobileInboxItemInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileInboxItem>();
protected static readonly Benchmark.Models.MobileBadgeAward MobileBadgeAwardInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBadgeAward>();
protected static readonly Benchmark.Models.MobilePrivilege MobilePrivilegeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobilePrivilege>();
protected static readonly Benchmark.Models.MobileCommunityBulletin MobileCommunityBulletinInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileCommunityBulletin>();
protected static readonly Benchmark.Models.MobileAssociationBonus MobileAssociationBonusInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileAssociationBonus>();
protected static readonly Benchmark.Models.MobileCareersJobAd MobileCareersJobAdInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileCareersJobAd>();
protected static readonly Benchmark.Models.MobileBannerAd MobileBannerAdInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBannerAd>();
protected static readonly Benchmark.Models.MobileUpdateNotice MobileUpdateNoticeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileUpdateNotice>();
protected static readonly Benchmark.Models.FlagOption FlagOptionInput = ExpressionTreeFixture.Create<Benchmark.Models.FlagOption>();
protected static readonly Benchmark.Models.InboxItem InboxItemInput = ExpressionTreeFixture.Create<Benchmark.Models.InboxItem>();
protected static readonly Benchmark.Models.Info InfoInput = ExpressionTreeFixture.Create<Benchmark.Models.Info>();
protected static readonly Benchmark.Models.NetworkUser NetworkUserInput = ExpressionTreeFixture.Create<Benchmark.Models.NetworkUser>();
protected static readonly Benchmark.Models.Notification NotificationInput = ExpressionTreeFixture.Create<Benchmark.Models.Notification>();
protected static readonly Benchmark.Models.Post PostInput = ExpressionTreeFixture.Create<Benchmark.Models.Post>();
protected static readonly Benchmark.Models.Privilege PrivilegeInput = ExpressionTreeFixture.Create<Benchmark.Models.Privilege>();
protected static readonly Benchmark.Models.Question QuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.Question>();
protected static readonly Benchmark.Models.QuestionTimeline QuestionTimelineInput = ExpressionTreeFixture.Create<Benchmark.Models.QuestionTimeline>();
protected static readonly Benchmark.Models.Reputation ReputationInput = ExpressionTreeFixture.Create<Benchmark.Models.Reputation>();
protected static readonly Benchmark.Models.ReputationHistory ReputationHistoryInput = ExpressionTreeFixture.Create<Benchmark.Models.ReputationHistory>();
protected static readonly Benchmark.Models.Revision RevisionInput = ExpressionTreeFixture.Create<Benchmark.Models.Revision>();
protected static readonly Benchmark.Models.SearchExcerpt SearchExcerptInput = ExpressionTreeFixture.Create<Benchmark.Models.SearchExcerpt>();
protected static readonly Benchmark.Models.ShallowUser ShallowUserInput = ExpressionTreeFixture.Create<Benchmark.Models.ShallowUser>();
protected static readonly Benchmark.Models.SuggestedEdit SuggestedEditInput = ExpressionTreeFixture.Create<Benchmark.Models.SuggestedEdit>();
protected static readonly Benchmark.Models.Tag TagInput = ExpressionTreeFixture.Create<Benchmark.Models.Tag>();
protected static readonly Benchmark.Models.TagScore TagScoreInput = ExpressionTreeFixture.Create<Benchmark.Models.TagScore>();
protected static readonly Benchmark.Models.TagSynonym TagSynonymInput = ExpressionTreeFixture.Create<Benchmark.Models.TagSynonym>();
protected static readonly Benchmark.Models.TagWiki TagWikiInput = ExpressionTreeFixture.Create<Benchmark.Models.TagWiki>();
protected static readonly Benchmark.Models.TopTag TopTagInput = ExpressionTreeFixture.Create<Benchmark.Models.TopTag>();
protected static readonly Benchmark.Models.User UserInput = ExpressionTreeFixture.Create<Benchmark.Models.User>();
protected static readonly Benchmark.Models.UserTimeline UserTimelineInput = ExpressionTreeFixture.Create<Benchmark.Models.UserTimeline>();
protected static readonly Benchmark.Models.WritePermission WritePermissionInput = ExpressionTreeFixture.Create<Benchmark.Models.WritePermission>();
protected static readonly Benchmark.Models.MobileBannerAd.MobileBannerAdImage MobileBannerAdImageInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBannerAd.MobileBannerAdImage>();
protected static readonly Benchmark.Models.Info.Site SiteInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.Site>();
protected static readonly Benchmark.Models.Info.RelatedSite RelatedSiteInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.RelatedSite>();
protected static readonly Benchmark.Models.Question.ClosedDetails ClosedDetailsInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.ClosedDetails>();
protected static readonly Benchmark.Models.Question.Notice NoticeInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.Notice>();
protected static readonly Benchmark.Models.Question.MigrationInfo MigrationInfoInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.MigrationInfo>();
protected static readonly Benchmark.Models.User.BadgeCount BadgeCountInput = ExpressionTreeFixture.Create<Benchmark.Models.User.BadgeCount>();
protected static readonly Benchmark.Models.Info.Site.Styling StylingInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.Site.Styling>();
protected static readonly Benchmark.Models.Question.ClosedDetails.OriginalQuestion OriginalQuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.ClosedDetails.OriginalQuestion>();
object SByteOutput;
object ShortOutput;
object IntOutput;
object LongOutput;
object ByteOutput;
object UShortOutput;
object UIntOutput;
object ULongOutput;
object BoolOutput;
object StringOutput;
object CharOutput;
object DateTimeOutput;
object GuidOutput;
object BytesOutput;
object AccessTokenOutput;
object AccountMergeOutput;
object AnswerOutput;
object BadgeOutput;
object CommentOutput;
object ErrorOutput;
object EventOutput;
object MobileFeedOutput;
object MobileQuestionOutput;
object MobileRepChangeOutput;
object MobileInboxItemOutput;
object MobileBadgeAwardOutput;
object MobilePrivilegeOutput;
object MobileCommunityBulletinOutput;
object MobileAssociationBonusOutput;
object MobileCareersJobAdOutput;
object MobileBannerAdOutput;
object MobileUpdateNoticeOutput;
object FlagOptionOutput;
object InboxItemOutput;
object InfoOutput;
object NetworkUserOutput;
object NotificationOutput;
object PostOutput;
object PrivilegeOutput;
object QuestionOutput;
object QuestionTimelineOutput;
object ReputationOutput;
object ReputationHistoryOutput;
object RevisionOutput;
object SearchExcerptOutput;
object ShallowUserOutput;
object SuggestedEditOutput;
object TagOutput;
object TagScoreOutput;
object TagSynonymOutput;
object TagWikiOutput;
object TopTagOutput;
object UserOutput;
object UserTimelineOutput;
object WritePermissionOutput;
object MobileBannerAdImageOutput;
object SiteOutput;
object RelatedSiteOutput;
object ClosedDetailsOutput;
object NoticeOutput;
object MigrationInfoOutput;
object BadgeCountOutput;
object StylingOutput;
object OriginalQuestionOutput;
[GlobalSetup]
public void Setup()
{
// primitives
SByteOutput = Serializer.Serialize(SByteInput);
ShortOutput = Serializer.Serialize(ShortInput);
IntOutput = Serializer.Serialize(IntInput);
LongOutput = Serializer.Serialize(LongInput);
ByteOutput = Serializer.Serialize(ByteInput);
UShortOutput = Serializer.Serialize(UShortInput);
UIntOutput = Serializer.Serialize(UIntInput);
ULongOutput = Serializer.Serialize(ULongInput);
BoolOutput = Serializer.Serialize(BoolInput);
StringOutput = Serializer.Serialize(StringInput);
CharOutput = Serializer.Serialize(CharInput);
DateTimeOutput = Serializer.Serialize(DateTimeInput);
GuidOutput = Serializer.Serialize(GuidInput);
BytesOutput = Serializer.Serialize(BytesInput);
// models
AccessTokenOutput = Serializer.Serialize(AccessTokenInput);
AccountMergeOutput = Serializer.Serialize(AccountMergeInput);
AnswerOutput = Serializer.Serialize(AnswerInput);
BadgeOutput = Serializer.Serialize(BadgeInput);
CommentOutput = Serializer.Serialize(CommentInput);
ErrorOutput = Serializer.Serialize(ErrorInput);
EventOutput = Serializer.Serialize(EventInput);
MobileFeedOutput = Serializer.Serialize(MobileFeedInput);
MobileQuestionOutput = Serializer.Serialize(MobileQuestionInput);
MobileRepChangeOutput = Serializer.Serialize(MobileRepChangeInput);
MobileInboxItemOutput = Serializer.Serialize(MobileInboxItemInput);
MobileBadgeAwardOutput = Serializer.Serialize(MobileBadgeAwardInput);
MobilePrivilegeOutput = Serializer.Serialize(MobilePrivilegeInput);
MobileCommunityBulletinOutput = Serializer.Serialize(MobileCommunityBulletinInput);
MobileAssociationBonusOutput = Serializer.Serialize(MobileAssociationBonusInput);
MobileCareersJobAdOutput = Serializer.Serialize(MobileCareersJobAdInput);
MobileBannerAdOutput = Serializer.Serialize(MobileBannerAdInput);
MobileUpdateNoticeOutput = Serializer.Serialize(MobileUpdateNoticeInput);
FlagOptionOutput = Serializer.Serialize(FlagOptionInput);
InboxItemOutput = Serializer.Serialize(InboxItemInput);
InfoOutput = Serializer.Serialize(InfoInput);
NetworkUserOutput = Serializer.Serialize(NetworkUserInput);
NotificationOutput = Serializer.Serialize(NotificationInput);
PostOutput = Serializer.Serialize(PostInput);
PrivilegeOutput = Serializer.Serialize(PrivilegeInput);
QuestionOutput = Serializer.Serialize(QuestionInput);
QuestionTimelineOutput = Serializer.Serialize(QuestionTimelineInput);
ReputationOutput = Serializer.Serialize(ReputationInput);
ReputationHistoryOutput = Serializer.Serialize(ReputationHistoryInput);
RevisionOutput = Serializer.Serialize(RevisionInput);
SearchExcerptOutput = Serializer.Serialize(SearchExcerptInput);
ShallowUserOutput = Serializer.Serialize(ShallowUserInput);
SuggestedEditOutput = Serializer.Serialize(SuggestedEditInput);
TagOutput = Serializer.Serialize(TagInput);
TagScoreOutput = Serializer.Serialize(TagScoreInput);
TagSynonymOutput = Serializer.Serialize(TagSynonymInput);
TagWikiOutput = Serializer.Serialize(TagWikiInput);
TopTagOutput = Serializer.Serialize(TopTagInput);
UserOutput = Serializer.Serialize(UserInput);
UserTimelineOutput = Serializer.Serialize(UserTimelineInput);
WritePermissionOutput = Serializer.Serialize(WritePermissionInput);
MobileBannerAdImageOutput = Serializer.Serialize(MobileBannerAdImageInput);
SiteOutput = Serializer.Serialize(SiteInput);
RelatedSiteOutput = Serializer.Serialize(RelatedSiteInput);
ClosedDetailsOutput = Serializer.Serialize(ClosedDetailsInput);
NoticeOutput = Serializer.Serialize(NoticeInput);
MigrationInfoOutput = Serializer.Serialize(MigrationInfoInput);
BadgeCountOutput = Serializer.Serialize(BadgeCountInput);
StylingOutput = Serializer.Serialize(StylingInput);
OriginalQuestionOutput = Serializer.Serialize(OriginalQuestionInput);
}
// Serialize
[Benchmark] public object _PrimitiveSByteSerialize() => Serializer.Serialize(SByteInput);
[Benchmark] public object _PrimitiveShortSerialize() => Serializer.Serialize(ShortInput);
[Benchmark] public object _PrimitiveIntSerialize() => Serializer.Serialize(IntInput);
[Benchmark] public object _PrimitiveLongSerialize() => Serializer.Serialize(LongInput);
[Benchmark] public object _PrimitiveByteSerialize() => Serializer.Serialize(ByteInput);
[Benchmark] public object _PrimitiveUShortSerialize() => Serializer.Serialize(UShortInput);
[Benchmark] public object _PrimitiveUIntSerialize() => Serializer.Serialize(UIntInput);
[Benchmark] public object _PrimitiveULongSerialize() => Serializer.Serialize(ULongInput);
[Benchmark] public object _PrimitiveBoolSerialize() => Serializer.Serialize(BoolInput);
[Benchmark] public object _PrimitiveStringSerialize() => Serializer.Serialize(StringInput);
[Benchmark] public object _PrimitiveCharSerialize() => Serializer.Serialize(CharInput);
[Benchmark] public object _PrimitiveDateTimeSerialize() => Serializer.Serialize(DateTimeInput);
[Benchmark] public object _PrimitiveGuidSerialize() => Serializer.Serialize(GuidInput);
[Benchmark] public object _PrimitiveBytesSerialize() => Serializer.Serialize(BytesInput);
[Benchmark] public object AccessTokenSerialize() => Serializer.Serialize(AccessTokenInput);
[Benchmark] public object AccountMergeSerialize() => Serializer.Serialize(AccountMergeInput);
[Benchmark] public object AnswerSerialize() => Serializer.Serialize(AnswerInput);
[Benchmark] public object BadgeSerialize() => Serializer.Serialize(BadgeInput);
[Benchmark] public object CommentSerialize() => Serializer.Serialize(CommentInput);
[Benchmark] public object ErrorSerialize() => Serializer.Serialize(ErrorInput);
[Benchmark] public object EventSerialize() => Serializer.Serialize(EventInput);
[Benchmark] public object MobileFeedSerialize() => Serializer.Serialize(MobileFeedInput);
[Benchmark] public object MobileQuestionSerialize() => Serializer.Serialize(MobileQuestionInput);
[Benchmark] public object MobileRepChangeSerialize() => Serializer.Serialize(MobileRepChangeInput);
[Benchmark] public object MobileInboxItemSerialize() => Serializer.Serialize(MobileInboxItemInput);
[Benchmark] public object MobileBadgeAwardSerialize() => Serializer.Serialize(MobileBadgeAwardInput);
[Benchmark] public object MobilePrivilegeSerialize() => Serializer.Serialize(MobilePrivilegeInput);
[Benchmark] public object MobileCommunityBulletinSerialize() => Serializer.Serialize(MobileCommunityBulletinInput);
[Benchmark] public object MobileAssociationBonusSerialize() => Serializer.Serialize(MobileAssociationBonusInput);
[Benchmark] public object MobileCareersJobAdSerialize() => Serializer.Serialize(MobileCareersJobAdInput);
[Benchmark] public object MobileBannerAdSerialize() => Serializer.Serialize(MobileBannerAdInput);
[Benchmark] public object MobileUpdateNoticeSerialize() => Serializer.Serialize(MobileUpdateNoticeInput);
[Benchmark] public object FlagOptionSerialize() => Serializer.Serialize(FlagOptionInput);
[Benchmark] public object InboxItemSerialize() => Serializer.Serialize(InboxItemInput);
[Benchmark] public object InfoSerialize() => Serializer.Serialize(InfoInput);
[Benchmark] public object NetworkUserSerialize() => Serializer.Serialize(NetworkUserInput);
[Benchmark] public object NotificationSerialize() => Serializer.Serialize(NotificationInput);
[Benchmark] public object PostSerialize() => Serializer.Serialize(PostInput);
[Benchmark] public object PrivilegeSerialize() => Serializer.Serialize(PrivilegeInput);
[Benchmark] public object QuestionSerialize() => Serializer.Serialize(QuestionInput);
[Benchmark] public object QuestionTimelineSerialize() => Serializer.Serialize(QuestionTimelineInput);
[Benchmark] public object ReputationSerialize() => Serializer.Serialize(ReputationInput);
[Benchmark] public object ReputationHistorySerialize() => Serializer.Serialize(ReputationHistoryInput);
[Benchmark] public object RevisionSerialize() => Serializer.Serialize(RevisionInput);
[Benchmark] public object SearchExcerptSerialize() => Serializer.Serialize(SearchExcerptInput);
[Benchmark] public object ShallowUserSerialize() => Serializer.Serialize(ShallowUserInput);
[Benchmark] public object SuggestedEditSerialize() => Serializer.Serialize(SuggestedEditInput);
[Benchmark] public object TagSerialize() => Serializer.Serialize(TagInput);
[Benchmark] public object TagScoreSerialize() => Serializer.Serialize(TagScoreInput);
[Benchmark] public object TagSynonymSerialize() => Serializer.Serialize(TagSynonymInput);
[Benchmark] public object TagWikiSerialize() => Serializer.Serialize(TagWikiInput);
[Benchmark] public object TopTagSerialize() => Serializer.Serialize(TopTagInput);
[Benchmark] public object UserSerialize() => Serializer.Serialize(UserInput);
[Benchmark] public object UserTimelineSerialize() => Serializer.Serialize(UserTimelineInput);
[Benchmark] public object WritePermissionSerialize() => Serializer.Serialize(WritePermissionInput);
[Benchmark] public object MobileBannerAdImageSerialize() => Serializer.Serialize(MobileBannerAdImageInput);
[Benchmark] public object SiteSerialize() => Serializer.Serialize(SiteInput);
[Benchmark] public object RelatedSiteSerialize() => Serializer.Serialize(RelatedSiteInput);
[Benchmark] public object ClosedDetailsSerialize() => Serializer.Serialize(ClosedDetailsInput);
[Benchmark] public object NoticeSerialize() => Serializer.Serialize(NoticeInput);
[Benchmark] public object MigrationInfoSerialize() => Serializer.Serialize(MigrationInfoInput);
[Benchmark] public object BadgeCountSerialize() => Serializer.Serialize(BadgeCountInput);
[Benchmark] public object StylingSerialize() => Serializer.Serialize(StylingInput);
[Benchmark] public object OriginalQuestionSerialize() => Serializer.Serialize(OriginalQuestionInput);
// Deserialize
[Benchmark] public SByte _PrimitiveSByteDeserialize() => Serializer.Deserialize<SByte>(SByteOutput);
[Benchmark] public short _PrimitiveShortDeserialize() => Serializer.Deserialize<short>(ShortOutput);
[Benchmark] public Int32 _PrimitiveIntDeserialize() => Serializer.Deserialize<Int32>(IntOutput);
[Benchmark] public Int64 _PrimitiveLongDeserialize() => Serializer.Deserialize<Int64>(LongOutput);
[Benchmark] public Byte _PrimitiveByteDeserialize() => Serializer.Deserialize<Byte>(ByteOutput);
[Benchmark] public ushort _PrimitiveUShortDeserialize() => Serializer.Deserialize<ushort>(UShortOutput);
[Benchmark] public uint _PrimitiveUIntDeserialize() => Serializer.Deserialize<uint>(UIntOutput);
[Benchmark] public ulong _PrimitiveULongDeserialize() => Serializer.Deserialize<ulong>(ULongOutput);
[Benchmark] public bool _PrimitiveBoolDeserialize() => Serializer.Deserialize<bool>(BoolOutput);
[Benchmark] public String _PrimitiveStringDeserialize() => Serializer.Deserialize<String>(StringOutput);
[Benchmark] public Char _PrimitiveCharDeserialize() => Serializer.Deserialize<Char>(CharOutput);
[Benchmark] public DateTime _PrimitiveDateTimeDeserialize() => Serializer.Deserialize<DateTime>(DateTimeOutput);
[Benchmark] public Guid _PrimitiveGuidDeserialize() => Serializer.Deserialize<Guid>(GuidOutput);
[Benchmark] public byte[] _PrimitiveBytesDeserialize() => Serializer.Deserialize<byte[]>(BytesOutput);
[Benchmark] public AccessToken AccessTokenDeserialize() => Serializer.Deserialize<AccessToken>(AccessTokenOutput);
[Benchmark] public AccountMerge AccountMergeDeserialize() => Serializer.Deserialize<AccountMerge>(AccountMergeOutput);
[Benchmark] public Answer AnswerDeserialize() => Serializer.Deserialize<Answer>(AnswerOutput);
[Benchmark] public Badge BadgeDeserialize() => Serializer.Deserialize<Badge>(BadgeOutput);
[Benchmark] public Comment CommentDeserialize() => Serializer.Deserialize<Comment>(CommentOutput);
[Benchmark] public Error ErrorDeserialize() => Serializer.Deserialize<Error>(ErrorOutput);
[Benchmark] public Event EventDeserialize() => Serializer.Deserialize<Event>(EventOutput);
[Benchmark] public MobileFeed MobileFeedDeserialize() => Serializer.Deserialize<MobileFeed>(MobileFeedOutput);
[Benchmark] public MobileQuestion MobileQuestionDeserialize() => Serializer.Deserialize<MobileQuestion>(MobileQuestionOutput);
[Benchmark] public MobileRepChange MobileRepChangeDeserialize() => Serializer.Deserialize<MobileRepChange>(MobileRepChangeOutput);
[Benchmark] public MobileInboxItem MobileInboxItemDeserialize() => Serializer.Deserialize<MobileInboxItem>(MobileInboxItemOutput);
[Benchmark] public MobileBadgeAward MobileBadgeAwardDeserialize() => Serializer.Deserialize<MobileBadgeAward>(MobileBadgeAwardOutput);
[Benchmark] public MobilePrivilege MobilePrivilegeDeserialize() => Serializer.Deserialize<MobilePrivilege>(MobilePrivilegeOutput);
[Benchmark] public MobileCommunityBulletin MobileCommunityBulletinDeserialize() => Serializer.Deserialize<MobileCommunityBulletin>(MobileCommunityBulletinOutput);
[Benchmark] public MobileAssociationBonus MobileAssociationBonusDeserialize() => Serializer.Deserialize<MobileAssociationBonus>(MobileAssociationBonusOutput);
[Benchmark] public MobileCareersJobAd MobileCareersJobAdDeserialize() => Serializer.Deserialize<MobileCareersJobAd>(MobileCareersJobAdOutput);
[Benchmark] public MobileBannerAd MobileBannerAdDeserialize() => Serializer.Deserialize<MobileBannerAd>(MobileBannerAdOutput);
[Benchmark] public MobileUpdateNotice MobileUpdateNoticeDeserialize() => Serializer.Deserialize<MobileUpdateNotice>(MobileUpdateNoticeOutput);
[Benchmark] public FlagOption FlagOptionDeserialize() => Serializer.Deserialize<FlagOption>(FlagOptionOutput);
[Benchmark] public InboxItem InboxItemDeserialize() => Serializer.Deserialize<InboxItem>(InboxItemOutput);
[Benchmark] public Info InfoDeserialize() => Serializer.Deserialize<Info>(InfoOutput);
[Benchmark] public NetworkUser NetworkUserDeserialize() => Serializer.Deserialize<NetworkUser>(NetworkUserOutput);
[Benchmark] public Notification NotificationDeserialize() => Serializer.Deserialize<Notification>(NotificationOutput);
[Benchmark] public Post PostDeserialize() => Serializer.Deserialize<Post>(PostOutput);
[Benchmark] public Privilege PrivilegeDeserialize() => Serializer.Deserialize<Privilege>(PrivilegeOutput);
[Benchmark] public Question QuestionDeserialize() => Serializer.Deserialize<Question>(QuestionOutput);
[Benchmark] public QuestionTimeline QuestionTimelineDeserialize() => Serializer.Deserialize<QuestionTimeline>(QuestionTimelineOutput);
[Benchmark] public Reputation ReputationDeserialize() => Serializer.Deserialize<Reputation>(ReputationOutput);
[Benchmark] public ReputationHistory ReputationHistoryDeserialize() => Serializer.Deserialize<ReputationHistory>(ReputationHistoryOutput);
[Benchmark] public Revision RevisionDeserialize() => Serializer.Deserialize<Revision>(RevisionOutput);
[Benchmark] public SearchExcerpt SearchExcerptDeserialize() => Serializer.Deserialize<SearchExcerpt>(SearchExcerptOutput);
[Benchmark] public ShallowUser ShallowUserDeserialize() => Serializer.Deserialize<ShallowUser>(ShallowUserOutput);
[Benchmark] public SuggestedEdit SuggestedEditDeserialize() => Serializer.Deserialize<SuggestedEdit>(SuggestedEditOutput);
[Benchmark] public Tag TagDeserialize() => Serializer.Deserialize<Tag>(TagOutput);
[Benchmark] public TagScore TagScoreDeserialize() => Serializer.Deserialize<TagScore>(TagScoreOutput);
[Benchmark] public TagSynonym TagSynonymDeserialize() => Serializer.Deserialize<TagSynonym>(TagSynonymOutput);
[Benchmark] public TagWiki TagWikiDeserialize() => Serializer.Deserialize<TagWiki>(TagWikiOutput);
[Benchmark] public TopTag TopTagDeserialize() => Serializer.Deserialize<TopTag>(TopTagOutput);
[Benchmark] public User UserDeserialize() => Serializer.Deserialize<User>(UserOutput);
[Benchmark] public UserTimeline UserTimelineDeserialize() => Serializer.Deserialize<UserTimeline>(UserTimelineOutput);
[Benchmark] public WritePermission WritePermissionDeserialize() => Serializer.Deserialize<WritePermission>(WritePermissionOutput);
[Benchmark] public MobileBannerAd.MobileBannerAdImage MobileBannerAdImageDeserialize() => Serializer.Deserialize<MobileBannerAd.MobileBannerAdImage>(MobileBannerAdImageOutput);
[Benchmark] public Info.Site SiteDeserialize() => Serializer.Deserialize<Info.Site>(SiteOutput);
[Benchmark] public Info.RelatedSite RelatedSiteDeserialize() => Serializer.Deserialize<Info.RelatedSite>(RelatedSiteOutput);
[Benchmark] public Question.ClosedDetails ClosedDetailsDeserialize() => Serializer.Deserialize<Question.ClosedDetails>(ClosedDetailsOutput);
[Benchmark] public Question.Notice NoticeDeserialize() => Serializer.Deserialize<Question.Notice>(NoticeOutput);
[Benchmark] public Question.MigrationInfo MigrationInfoDeserialize() => Serializer.Deserialize<Question.MigrationInfo>(MigrationInfoOutput);
[Benchmark] public User.BadgeCount BadgeCountDeserialize() => Serializer.Deserialize<User.BadgeCount>(BadgeCountOutput);
[Benchmark] public Info.Site.Styling StylingDeserialize() => Serializer.Deserialize<Info.Site.Styling>(StylingOutput);
[Benchmark] public Question.ClosedDetails.OriginalQuestion OriginalQuestionDeserialize() => Serializer.Deserialize<Question.ClosedDetails.OriginalQuestion>(OriginalQuestionOutput);
}
[Config(typeof(BenchmarkConfig))]
public class MsgPackV1_Vs_MsgPackV2_BytesInOut // : AllSerializerBenchmark
{
[ParamsSource(nameof(Serializers))]
public SerializerBase Serializer;
// Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:)
public IEnumerable<SerializerBase> Serializers => new SerializerBase[]
{
new MessagePack_v1(),
new MessagePack_v2(),
};
protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture();
// primitives
protected static readonly sbyte SByteInput = ExpressionTreeFixture.Create<sbyte>();
protected static readonly short ShortInput = ExpressionTreeFixture.Create<short>();
protected static readonly int IntInput = ExpressionTreeFixture.Create<int>();
protected static readonly long LongInput = ExpressionTreeFixture.Create<long>();
protected static readonly byte ByteInput = ExpressionTreeFixture.Create<byte>();
protected static readonly ushort UShortInput = ExpressionTreeFixture.Create<ushort>();
protected static readonly uint UIntInput = ExpressionTreeFixture.Create<uint>();
protected static readonly ulong ULongInput = ExpressionTreeFixture.Create<ulong>();
protected static readonly bool BoolInput = ExpressionTreeFixture.Create<bool>();
protected static readonly string StringInput = ExpressionTreeFixture.Create<string>();
protected static readonly char CharInput = ExpressionTreeFixture.Create<char>();
protected static readonly DateTime DateTimeInput = ExpressionTreeFixture.Create<DateTime>();
protected static readonly Guid GuidInput = ExpressionTreeFixture.Create<Guid>();
protected static readonly byte[] BytesInput = ExpressionTreeFixture.Create<byte[]>();
// models
protected static readonly Benchmark.Models.AccessToken AccessTokenInput = ExpressionTreeFixture.Create<Benchmark.Models.AccessToken>();
protected static readonly Benchmark.Models.AccountMerge AccountMergeInput = ExpressionTreeFixture.Create<Benchmark.Models.AccountMerge>();
protected static readonly Benchmark.Models.Answer AnswerInput = ExpressionTreeFixture.Create<Benchmark.Models.Answer>();
protected static readonly Benchmark.Models.Badge BadgeInput = ExpressionTreeFixture.Create<Benchmark.Models.Badge>();
protected static readonly Benchmark.Models.Comment CommentInput = ExpressionTreeFixture.Create<Benchmark.Models.Comment>();
protected static readonly Benchmark.Models.Error ErrorInput = ExpressionTreeFixture.Create<Benchmark.Models.Error>();
protected static readonly Benchmark.Models.Event EventInput = ExpressionTreeFixture.Create<Benchmark.Models.Event>();
protected static readonly Benchmark.Models.MobileFeed MobileFeedInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileFeed>();
protected static readonly Benchmark.Models.MobileQuestion MobileQuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileQuestion>();
protected static readonly Benchmark.Models.MobileRepChange MobileRepChangeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileRepChange>();
protected static readonly Benchmark.Models.MobileInboxItem MobileInboxItemInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileInboxItem>();
protected static readonly Benchmark.Models.MobileBadgeAward MobileBadgeAwardInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBadgeAward>();
protected static readonly Benchmark.Models.MobilePrivilege MobilePrivilegeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobilePrivilege>();
protected static readonly Benchmark.Models.MobileCommunityBulletin MobileCommunityBulletinInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileCommunityBulletin>();
protected static readonly Benchmark.Models.MobileAssociationBonus MobileAssociationBonusInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileAssociationBonus>();
protected static readonly Benchmark.Models.MobileCareersJobAd MobileCareersJobAdInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileCareersJobAd>();
protected static readonly Benchmark.Models.MobileBannerAd MobileBannerAdInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBannerAd>();
protected static readonly Benchmark.Models.MobileUpdateNotice MobileUpdateNoticeInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileUpdateNotice>();
protected static readonly Benchmark.Models.FlagOption FlagOptionInput = ExpressionTreeFixture.Create<Benchmark.Models.FlagOption>();
protected static readonly Benchmark.Models.InboxItem InboxItemInput = ExpressionTreeFixture.Create<Benchmark.Models.InboxItem>();
protected static readonly Benchmark.Models.Info InfoInput = ExpressionTreeFixture.Create<Benchmark.Models.Info>();
protected static readonly Benchmark.Models.NetworkUser NetworkUserInput = ExpressionTreeFixture.Create<Benchmark.Models.NetworkUser>();
protected static readonly Benchmark.Models.Notification NotificationInput = ExpressionTreeFixture.Create<Benchmark.Models.Notification>();
protected static readonly Benchmark.Models.Post PostInput = ExpressionTreeFixture.Create<Benchmark.Models.Post>();
protected static readonly Benchmark.Models.Privilege PrivilegeInput = ExpressionTreeFixture.Create<Benchmark.Models.Privilege>();
protected static readonly Benchmark.Models.Question QuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.Question>();
protected static readonly Benchmark.Models.QuestionTimeline QuestionTimelineInput = ExpressionTreeFixture.Create<Benchmark.Models.QuestionTimeline>();
protected static readonly Benchmark.Models.Reputation ReputationInput = ExpressionTreeFixture.Create<Benchmark.Models.Reputation>();
protected static readonly Benchmark.Models.ReputationHistory ReputationHistoryInput = ExpressionTreeFixture.Create<Benchmark.Models.ReputationHistory>();
protected static readonly Benchmark.Models.Revision RevisionInput = ExpressionTreeFixture.Create<Benchmark.Models.Revision>();
protected static readonly Benchmark.Models.SearchExcerpt SearchExcerptInput = ExpressionTreeFixture.Create<Benchmark.Models.SearchExcerpt>();
protected static readonly Benchmark.Models.ShallowUser ShallowUserInput = ExpressionTreeFixture.Create<Benchmark.Models.ShallowUser>();
protected static readonly Benchmark.Models.SuggestedEdit SuggestedEditInput = ExpressionTreeFixture.Create<Benchmark.Models.SuggestedEdit>();
protected static readonly Benchmark.Models.Tag TagInput = ExpressionTreeFixture.Create<Benchmark.Models.Tag>();
protected static readonly Benchmark.Models.TagScore TagScoreInput = ExpressionTreeFixture.Create<Benchmark.Models.TagScore>();
protected static readonly Benchmark.Models.TagSynonym TagSynonymInput = ExpressionTreeFixture.Create<Benchmark.Models.TagSynonym>();
protected static readonly Benchmark.Models.TagWiki TagWikiInput = ExpressionTreeFixture.Create<Benchmark.Models.TagWiki>();
protected static readonly Benchmark.Models.TopTag TopTagInput = ExpressionTreeFixture.Create<Benchmark.Models.TopTag>();
protected static readonly Benchmark.Models.User UserInput = ExpressionTreeFixture.Create<Benchmark.Models.User>();
protected static readonly Benchmark.Models.UserTimeline UserTimelineInput = ExpressionTreeFixture.Create<Benchmark.Models.UserTimeline>();
protected static readonly Benchmark.Models.WritePermission WritePermissionInput = ExpressionTreeFixture.Create<Benchmark.Models.WritePermission>();
protected static readonly Benchmark.Models.MobileBannerAd.MobileBannerAdImage MobileBannerAdImageInput = ExpressionTreeFixture.Create<Benchmark.Models.MobileBannerAd.MobileBannerAdImage>();
protected static readonly Benchmark.Models.Info.Site SiteInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.Site>();
protected static readonly Benchmark.Models.Info.RelatedSite RelatedSiteInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.RelatedSite>();
protected static readonly Benchmark.Models.Question.ClosedDetails ClosedDetailsInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.ClosedDetails>();
protected static readonly Benchmark.Models.Question.Notice NoticeInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.Notice>();
protected static readonly Benchmark.Models.Question.MigrationInfo MigrationInfoInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.MigrationInfo>();
protected static readonly Benchmark.Models.User.BadgeCount BadgeCountInput = ExpressionTreeFixture.Create<Benchmark.Models.User.BadgeCount>();
protected static readonly Benchmark.Models.Info.Site.Styling StylingInput = ExpressionTreeFixture.Create<Benchmark.Models.Info.Site.Styling>();
protected static readonly Benchmark.Models.Question.ClosedDetails.OriginalQuestion OriginalQuestionInput = ExpressionTreeFixture.Create<Benchmark.Models.Question.ClosedDetails.OriginalQuestion>();
object SByteOutput;
object ShortOutput;
object IntOutput;
object LongOutput;
object ByteOutput;
object UShortOutput;
object UIntOutput;
object ULongOutput;
object BoolOutput;
object StringOutput;
object CharOutput;
object DateTimeOutput;
object GuidOutput;
object BytesOutput;
object AccessTokenOutput;
object AccountMergeOutput;
object AnswerOutput;
object BadgeOutput;
object CommentOutput;
object ErrorOutput;
object EventOutput;
object MobileFeedOutput;
object MobileQuestionOutput;
object MobileRepChangeOutput;
object MobileInboxItemOutput;
object MobileBadgeAwardOutput;
object MobilePrivilegeOutput;
object MobileCommunityBulletinOutput;
object MobileAssociationBonusOutput;
object MobileCareersJobAdOutput;
object MobileBannerAdOutput;
object MobileUpdateNoticeOutput;
object FlagOptionOutput;
object InboxItemOutput;
object InfoOutput;
object NetworkUserOutput;
object NotificationOutput;
object PostOutput;
object PrivilegeOutput;
object QuestionOutput;
object QuestionTimelineOutput;
object ReputationOutput;
object ReputationHistoryOutput;
object RevisionOutput;
object SearchExcerptOutput;
object ShallowUserOutput;
object SuggestedEditOutput;
object TagOutput;
object TagScoreOutput;
object TagSynonymOutput;
object TagWikiOutput;
object TopTagOutput;
object UserOutput;
object UserTimelineOutput;
object WritePermissionOutput;
object MobileBannerAdImageOutput;
object SiteOutput;
object RelatedSiteOutput;
object ClosedDetailsOutput;
object NoticeOutput;
object MigrationInfoOutput;
object BadgeCountOutput;
object StylingOutput;
object OriginalQuestionOutput;
[GlobalSetup]
public void Setup()
{
// primitives
SByteOutput = Serializer.Serialize(SByteInput);
ShortOutput = Serializer.Serialize(ShortInput);
IntOutput = Serializer.Serialize(IntInput);
LongOutput = Serializer.Serialize(LongInput);
ByteOutput = Serializer.Serialize(ByteInput);
UShortOutput = Serializer.Serialize(UShortInput);
UIntOutput = Serializer.Serialize(UIntInput);
ULongOutput = Serializer.Serialize(ULongInput);
BoolOutput = Serializer.Serialize(BoolInput);
StringOutput = Serializer.Serialize(StringInput);
CharOutput = Serializer.Serialize(CharInput);
DateTimeOutput = Serializer.Serialize(DateTimeInput);
GuidOutput = Serializer.Serialize(GuidInput);
BytesOutput = Serializer.Serialize(BytesInput);
// models
AccessTokenOutput = Serializer.Serialize(AccessTokenInput);
AccountMergeOutput = Serializer.Serialize(AccountMergeInput);
AnswerOutput = Serializer.Serialize(AnswerInput);
BadgeOutput = Serializer.Serialize(BadgeInput);
CommentOutput = Serializer.Serialize(CommentInput);
ErrorOutput = Serializer.Serialize(ErrorInput);
EventOutput = Serializer.Serialize(EventInput);
MobileFeedOutput = Serializer.Serialize(MobileFeedInput);
MobileQuestionOutput = Serializer.Serialize(MobileQuestionInput);
MobileRepChangeOutput = Serializer.Serialize(MobileRepChangeInput);
MobileInboxItemOutput = Serializer.Serialize(MobileInboxItemInput);
MobileBadgeAwardOutput = Serializer.Serialize(MobileBadgeAwardInput);
MobilePrivilegeOutput = Serializer.Serialize(MobilePrivilegeInput);
MobileCommunityBulletinOutput = Serializer.Serialize(MobileCommunityBulletinInput);
MobileAssociationBonusOutput = Serializer.Serialize(MobileAssociationBonusInput);
MobileCareersJobAdOutput = Serializer.Serialize(MobileCareersJobAdInput);
MobileBannerAdOutput = Serializer.Serialize(MobileBannerAdInput);
MobileUpdateNoticeOutput = Serializer.Serialize(MobileUpdateNoticeInput);
FlagOptionOutput = Serializer.Serialize(FlagOptionInput);
InboxItemOutput = Serializer.Serialize(InboxItemInput);
InfoOutput = Serializer.Serialize(InfoInput);
NetworkUserOutput = Serializer.Serialize(NetworkUserInput);
NotificationOutput = Serializer.Serialize(NotificationInput);
PostOutput = Serializer.Serialize(PostInput);
PrivilegeOutput = Serializer.Serialize(PrivilegeInput);
QuestionOutput = Serializer.Serialize(QuestionInput);
QuestionTimelineOutput = Serializer.Serialize(QuestionTimelineInput);
ReputationOutput = Serializer.Serialize(ReputationInput);
ReputationHistoryOutput = Serializer.Serialize(ReputationHistoryInput);
RevisionOutput = Serializer.Serialize(RevisionInput);
SearchExcerptOutput = Serializer.Serialize(SearchExcerptInput);
ShallowUserOutput = Serializer.Serialize(ShallowUserInput);
SuggestedEditOutput = Serializer.Serialize(SuggestedEditInput);
TagOutput = Serializer.Serialize(TagInput);
TagScoreOutput = Serializer.Serialize(TagScoreInput);
TagSynonymOutput = Serializer.Serialize(TagSynonymInput);
TagWikiOutput = Serializer.Serialize(TagWikiInput);
TopTagOutput = Serializer.Serialize(TopTagInput);
UserOutput = Serializer.Serialize(UserInput);
UserTimelineOutput = Serializer.Serialize(UserTimelineInput);
WritePermissionOutput = Serializer.Serialize(WritePermissionInput);
MobileBannerAdImageOutput = Serializer.Serialize(MobileBannerAdImageInput);
SiteOutput = Serializer.Serialize(SiteInput);
RelatedSiteOutput = Serializer.Serialize(RelatedSiteInput);
ClosedDetailsOutput = Serializer.Serialize(ClosedDetailsInput);
NoticeOutput = Serializer.Serialize(NoticeInput);
MigrationInfoOutput = Serializer.Serialize(MigrationInfoInput);
BadgeCountOutput = Serializer.Serialize(BadgeCountInput);
StylingOutput = Serializer.Serialize(StylingInput);
OriginalQuestionOutput = Serializer.Serialize(OriginalQuestionInput);
}
// Serialize
[Benchmark] public object _PrimitiveSByteSerialize() => Serializer.Serialize(SByteInput);
[Benchmark] public object _PrimitiveShortSerialize() => Serializer.Serialize(ShortInput);
[Benchmark] public object _PrimitiveIntSerialize() => Serializer.Serialize(IntInput);
[Benchmark] public object _PrimitiveLongSerialize() => Serializer.Serialize(LongInput);
[Benchmark] public object _PrimitiveByteSerialize() => Serializer.Serialize(ByteInput);
[Benchmark] public object _PrimitiveUShortSerialize() => Serializer.Serialize(UShortInput);
[Benchmark] public object _PrimitiveUIntSerialize() => Serializer.Serialize(UIntInput);
[Benchmark] public object _PrimitiveULongSerialize() => Serializer.Serialize(ULongInput);
[Benchmark] public object _PrimitiveBoolSerialize() => Serializer.Serialize(BoolInput);
[Benchmark] public object _PrimitiveStringSerialize() => Serializer.Serialize(StringInput);
[Benchmark] public object _PrimitiveCharSerialize() => Serializer.Serialize(CharInput);
[Benchmark] public object _PrimitiveDateTimeSerialize() => Serializer.Serialize(DateTimeInput);
[Benchmark] public object _PrimitiveGuidSerialize() => Serializer.Serialize(GuidInput);
[Benchmark] public object _PrimitiveBytesSerialize() => Serializer.Serialize(BytesInput);
[Benchmark] public object AccessTokenSerialize() => Serializer.Serialize(AccessTokenInput);
[Benchmark] public object AccountMergeSerialize() => Serializer.Serialize(AccountMergeInput);
[Benchmark] public object AnswerSerialize() => Serializer.Serialize(AnswerInput);
[Benchmark] public object BadgeSerialize() => Serializer.Serialize(BadgeInput);
[Benchmark] public object CommentSerialize() => Serializer.Serialize(CommentInput);
[Benchmark] public object ErrorSerialize() => Serializer.Serialize(ErrorInput);
[Benchmark] public object EventSerialize() => Serializer.Serialize(EventInput);
[Benchmark] public object MobileFeedSerialize() => Serializer.Serialize(MobileFeedInput);
[Benchmark] public object MobileQuestionSerialize() => Serializer.Serialize(MobileQuestionInput);
[Benchmark] public object MobileRepChangeSerialize() => Serializer.Serialize(MobileRepChangeInput);
[Benchmark] public object MobileInboxItemSerialize() => Serializer.Serialize(MobileInboxItemInput);
[Benchmark] public object MobileBadgeAwardSerialize() => Serializer.Serialize(MobileBadgeAwardInput);
[Benchmark] public object MobilePrivilegeSerialize() => Serializer.Serialize(MobilePrivilegeInput);
[Benchmark] public object MobileCommunityBulletinSerialize() => Serializer.Serialize(MobileCommunityBulletinInput);
[Benchmark] public object MobileAssociationBonusSerialize() => Serializer.Serialize(MobileAssociationBonusInput);
[Benchmark] public object MobileCareersJobAdSerialize() => Serializer.Serialize(MobileCareersJobAdInput);
[Benchmark] public object MobileBannerAdSerialize() => Serializer.Serialize(MobileBannerAdInput);
[Benchmark] public object MobileUpdateNoticeSerialize() => Serializer.Serialize(MobileUpdateNoticeInput);
[Benchmark] public object FlagOptionSerialize() => Serializer.Serialize(FlagOptionInput);
[Benchmark] public object InboxItemSerialize() => Serializer.Serialize(InboxItemInput);
[Benchmark] public object InfoSerialize() => Serializer.Serialize(InfoInput);
[Benchmark] public object NetworkUserSerialize() => Serializer.Serialize(NetworkUserInput);
[Benchmark] public object NotificationSerialize() => Serializer.Serialize(NotificationInput);
[Benchmark] public object PostSerialize() => Serializer.Serialize(PostInput);
[Benchmark] public object PrivilegeSerialize() => Serializer.Serialize(PrivilegeInput);
[Benchmark] public object QuestionSerialize() => Serializer.Serialize(QuestionInput);
[Benchmark] public object QuestionTimelineSerialize() => Serializer.Serialize(QuestionTimelineInput);
[Benchmark] public object ReputationSerialize() => Serializer.Serialize(ReputationInput);
[Benchmark] public object ReputationHistorySerialize() => Serializer.Serialize(ReputationHistoryInput);
[Benchmark] public object RevisionSerialize() => Serializer.Serialize(RevisionInput);
[Benchmark] public object SearchExcerptSerialize() => Serializer.Serialize(SearchExcerptInput);
[Benchmark] public object ShallowUserSerialize() => Serializer.Serialize(ShallowUserInput);
[Benchmark] public object SuggestedEditSerialize() => Serializer.Serialize(SuggestedEditInput);
[Benchmark] public object TagSerialize() => Serializer.Serialize(TagInput);
[Benchmark] public object TagScoreSerialize() => Serializer.Serialize(TagScoreInput);
[Benchmark] public object TagSynonymSerialize() => Serializer.Serialize(TagSynonymInput);
[Benchmark] public object TagWikiSerialize() => Serializer.Serialize(TagWikiInput);
[Benchmark] public object TopTagSerialize() => Serializer.Serialize(TopTagInput);
[Benchmark] public object UserSerialize() => Serializer.Serialize(UserInput);
[Benchmark] public object UserTimelineSerialize() => Serializer.Serialize(UserTimelineInput);
[Benchmark] public object WritePermissionSerialize() => Serializer.Serialize(WritePermissionInput);
[Benchmark] public object MobileBannerAdImageSerialize() => Serializer.Serialize(MobileBannerAdImageInput);
[Benchmark] public object SiteSerialize() => Serializer.Serialize(SiteInput);
[Benchmark] public object RelatedSiteSerialize() => Serializer.Serialize(RelatedSiteInput);
[Benchmark] public object ClosedDetailsSerialize() => Serializer.Serialize(ClosedDetailsInput);
[Benchmark] public object NoticeSerialize() => Serializer.Serialize(NoticeInput);
[Benchmark] public object MigrationInfoSerialize() => Serializer.Serialize(MigrationInfoInput);
[Benchmark] public object BadgeCountSerialize() => Serializer.Serialize(BadgeCountInput);
[Benchmark] public object StylingSerialize() => Serializer.Serialize(StylingInput);
[Benchmark] public object OriginalQuestionSerialize() => Serializer.Serialize(OriginalQuestionInput);
// Deserialize
[Benchmark] public SByte _PrimitiveSByteDeserialize() => Serializer.Deserialize<SByte>(SByteOutput);
[Benchmark] public short _PrimitiveShortDeserialize() => Serializer.Deserialize<short>(ShortOutput);
[Benchmark] public Int32 _PrimitiveIntDeserialize() => Serializer.Deserialize<Int32>(IntOutput);
[Benchmark] public Int64 _PrimitiveLongDeserialize() => Serializer.Deserialize<Int64>(LongOutput);
[Benchmark] public Byte _PrimitiveByteDeserialize() => Serializer.Deserialize<Byte>(ByteOutput);
[Benchmark] public ushort _PrimitiveUShortDeserialize() => Serializer.Deserialize<ushort>(UShortOutput);
[Benchmark] public uint _PrimitiveUIntDeserialize() => Serializer.Deserialize<uint>(UIntOutput);
[Benchmark] public ulong _PrimitiveULongDeserialize() => Serializer.Deserialize<ulong>(ULongOutput);
[Benchmark] public bool _PrimitiveBoolDeserialize() => Serializer.Deserialize<bool>(BoolOutput);
[Benchmark] public String _PrimitiveStringDeserialize() => Serializer.Deserialize<String>(StringOutput);
[Benchmark] public Char _PrimitiveCharDeserialize() => Serializer.Deserialize<Char>(CharOutput);
[Benchmark] public DateTime _PrimitiveDateTimeDeserialize() => Serializer.Deserialize<DateTime>(DateTimeOutput);
[Benchmark] public Guid _PrimitiveGuidDeserialize() => Serializer.Deserialize<Guid>(GuidOutput);
[Benchmark] public byte[] _PrimitiveBytesDeserialize() => Serializer.Deserialize<byte[]>(BytesOutput);
[Benchmark] public AccessToken AccessTokenDeserialize() => Serializer.Deserialize<AccessToken>(AccessTokenOutput);
[Benchmark] public AccountMerge AccountMergeDeserialize() => Serializer.Deserialize<AccountMerge>(AccountMergeOutput);
[Benchmark] public Answer AnswerDeserialize() => Serializer.Deserialize<Answer>(AnswerOutput);
[Benchmark] public Badge BadgeDeserialize() => Serializer.Deserialize<Badge>(BadgeOutput);
[Benchmark] public Comment CommentDeserialize() => Serializer.Deserialize<Comment>(CommentOutput);
[Benchmark] public Error ErrorDeserialize() => Serializer.Deserialize<Error>(ErrorOutput);
[Benchmark] public Event EventDeserialize() => Serializer.Deserialize<Event>(EventOutput);
[Benchmark] public MobileFeed MobileFeedDeserialize() => Serializer.Deserialize<MobileFeed>(MobileFeedOutput);
[Benchmark] public MobileQuestion MobileQuestionDeserialize() => Serializer.Deserialize<MobileQuestion>(MobileQuestionOutput);
[Benchmark] public MobileRepChange MobileRepChangeDeserialize() => Serializer.Deserialize<MobileRepChange>(MobileRepChangeOutput);
[Benchmark] public MobileInboxItem MobileInboxItemDeserialize() => Serializer.Deserialize<MobileInboxItem>(MobileInboxItemOutput);
[Benchmark] public MobileBadgeAward MobileBadgeAwardDeserialize() => Serializer.Deserialize<MobileBadgeAward>(MobileBadgeAwardOutput);
[Benchmark] public MobilePrivilege MobilePrivilegeDeserialize() => Serializer.Deserialize<MobilePrivilege>(MobilePrivilegeOutput);
[Benchmark] public MobileCommunityBulletin MobileCommunityBulletinDeserialize() => Serializer.Deserialize<MobileCommunityBulletin>(MobileCommunityBulletinOutput);
[Benchmark] public MobileAssociationBonus MobileAssociationBonusDeserialize() => Serializer.Deserialize<MobileAssociationBonus>(MobileAssociationBonusOutput);
[Benchmark] public MobileCareersJobAd MobileCareersJobAdDeserialize() => Serializer.Deserialize<MobileCareersJobAd>(MobileCareersJobAdOutput);
[Benchmark] public MobileBannerAd MobileBannerAdDeserialize() => Serializer.Deserialize<MobileBannerAd>(MobileBannerAdOutput);
[Benchmark] public MobileUpdateNotice MobileUpdateNoticeDeserialize() => Serializer.Deserialize<MobileUpdateNotice>(MobileUpdateNoticeOutput);
[Benchmark] public FlagOption FlagOptionDeserialize() => Serializer.Deserialize<FlagOption>(FlagOptionOutput);
[Benchmark] public InboxItem InboxItemDeserialize() => Serializer.Deserialize<InboxItem>(InboxItemOutput);
[Benchmark] public Info InfoDeserialize() => Serializer.Deserialize<Info>(InfoOutput);
[Benchmark] public NetworkUser NetworkUserDeserialize() => Serializer.Deserialize<NetworkUser>(NetworkUserOutput);
[Benchmark] public Notification NotificationDeserialize() => Serializer.Deserialize<Notification>(NotificationOutput);
[Benchmark] public Post PostDeserialize() => Serializer.Deserialize<Post>(PostOutput);
[Benchmark] public Privilege PrivilegeDeserialize() => Serializer.Deserialize<Privilege>(PrivilegeOutput);
[Benchmark] public Question QuestionDeserialize() => Serializer.Deserialize<Question>(QuestionOutput);
[Benchmark] public QuestionTimeline QuestionTimelineDeserialize() => Serializer.Deserialize<QuestionTimeline>(QuestionTimelineOutput);
[Benchmark] public Reputation ReputationDeserialize() => Serializer.Deserialize<Reputation>(ReputationOutput);
[Benchmark] public ReputationHistory ReputationHistoryDeserialize() => Serializer.Deserialize<ReputationHistory>(ReputationHistoryOutput);
[Benchmark] public Revision RevisionDeserialize() => Serializer.Deserialize<Revision>(RevisionOutput);
[Benchmark] public SearchExcerpt SearchExcerptDeserialize() => Serializer.Deserialize<SearchExcerpt>(SearchExcerptOutput);
[Benchmark] public ShallowUser ShallowUserDeserialize() => Serializer.Deserialize<ShallowUser>(ShallowUserOutput);
[Benchmark] public SuggestedEdit SuggestedEditDeserialize() => Serializer.Deserialize<SuggestedEdit>(SuggestedEditOutput);
[Benchmark] public Tag TagDeserialize() => Serializer.Deserialize<Tag>(TagOutput);
[Benchmark] public TagScore TagScoreDeserialize() => Serializer.Deserialize<TagScore>(TagScoreOutput);
[Benchmark] public TagSynonym TagSynonymDeserialize() => Serializer.Deserialize<TagSynonym>(TagSynonymOutput);
[Benchmark] public TagWiki TagWikiDeserialize() => Serializer.Deserialize<TagWiki>(TagWikiOutput);
[Benchmark] public TopTag TopTagDeserialize() => Serializer.Deserialize<TopTag>(TopTagOutput);
[Benchmark] public User UserDeserialize() => Serializer.Deserialize<User>(UserOutput);
[Benchmark] public UserTimeline UserTimelineDeserialize() => Serializer.Deserialize<UserTimeline>(UserTimelineOutput);
[Benchmark] public WritePermission WritePermissionDeserialize() => Serializer.Deserialize<WritePermission>(WritePermissionOutput);
[Benchmark] public MobileBannerAd.MobileBannerAdImage MobileBannerAdImageDeserialize() => Serializer.Deserialize<MobileBannerAd.MobileBannerAdImage>(MobileBannerAdImageOutput);
[Benchmark] public Info.Site SiteDeserialize() => Serializer.Deserialize<Info.Site>(SiteOutput);
[Benchmark] public Info.RelatedSite RelatedSiteDeserialize() => Serializer.Deserialize<Info.RelatedSite>(RelatedSiteOutput);
[Benchmark] public Question.ClosedDetails ClosedDetailsDeserialize() => Serializer.Deserialize<Question.ClosedDetails>(ClosedDetailsOutput);
[Benchmark] public Question.Notice NoticeDeserialize() => Serializer.Deserialize<Question.Notice>(NoticeOutput);
[Benchmark] public Question.MigrationInfo MigrationInfoDeserialize() => Serializer.Deserialize<Question.MigrationInfo>(MigrationInfoOutput);
[Benchmark] public User.BadgeCount BadgeCountDeserialize() => Serializer.Deserialize<User.BadgeCount>(BadgeCountOutput);
[Benchmark] public Info.Site.Styling StylingDeserialize() => Serializer.Deserialize<Info.Site.Styling>(StylingOutput);
[Benchmark] public Question.ClosedDetails.OriginalQuestion OriginalQuestionDeserialize() => Serializer.Deserialize<Question.ClosedDetails.OriginalQuestion>(OriginalQuestionOutput);
}
[Config(typeof(BenchmarkConfig))]
public class ShortRun_AllSerializerBenchmark_BytesInOut
{
[ParamsSource(nameof(Serializers))]
public SerializerBase Serializer;
// Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:)
public IEnumerable<SerializerBase> Serializers => new SerializerBase[]
{
new MessagePack_v1(),
new MessagePack_v2(),
new MessagePackLz4_v1(),
new MessagePackLz4_v2(),
new ProtobufNet(),
new JsonNet(),
new BinaryFormatter_(),
new DataContract_(),
new Hyperion_(),
new Jil_(),
new SpanJson_(),
new Utf8Json_(),
new MsgPackCli(),
new FsPickler_(),
new Ceras_(),
};
protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture();
// primitives
protected static readonly int IntInput = ExpressionTreeFixture.Create<int>();
// models
protected static readonly Benchmark.Models.Answer AnswerInput = ExpressionTreeFixture.Create<Benchmark.Models.Answer>();
object IntOutput;
object AnswerOutput;
[GlobalSetup]
public void Setup()
{
// primitives
IntOutput = Serializer.Serialize(IntInput);
// models
AnswerOutput = Serializer.Serialize(AnswerInput);
}
// Serialize
[Benchmark] public object _PrimitiveIntSerialize() => Serializer.Serialize(IntInput);
[Benchmark] public object AnswerSerialize() => Serializer.Serialize(AnswerInput);
// Deserialize
[Benchmark] public Int32 _PrimitiveIntDeserialize() => Serializer.Deserialize<Int32>(IntOutput);
[Benchmark] public Answer AnswerDeserialize() => Serializer.Deserialize<Answer>(AnswerOutput);
}
[Config(typeof(BenchmarkConfig))]
public class ShortRun_MsgPackV1_Vs_MsgPackV2_BytesInOut
{
[ParamsSource(nameof(Serializers))]
public SerializerBase Serializer;
// Currently BenchmarkdDotNet does not detect inherited ParamsSource so use copy and paste:)
public IEnumerable<SerializerBase> Serializers => new SerializerBase[]
{
new MessagePack_v1(),
new MessagePack_v2(),
};
protected static readonly ExpressionTreeFixture ExpressionTreeFixture = new ExpressionTreeFixture();
// primitives
protected static readonly int IntInput = ExpressionTreeFixture.Create<int>();
// models
protected static readonly Benchmark.Models.Answer AnswerInput = ExpressionTreeFixture.Create<Benchmark.Models.Answer>();
object IntOutput;
object AnswerOutput;
[GlobalSetup]
public void Setup()
{
// primitives
IntOutput = Serializer.Serialize(IntInput);
// models
AnswerOutput = Serializer.Serialize(AnswerInput);
}
// Serialize
[Benchmark] public object _PrimitiveIntSerialize() => Serializer.Serialize(IntInput);
[Benchmark] public object AnswerSerialize() => Serializer.Serialize(AnswerInput);
// Deserialize
[Benchmark] public Int32 _PrimitiveIntDeserialize() => Serializer.Deserialize<Int32>(IntOutput);
[Benchmark] public Answer AnswerDeserialize() => Serializer.Deserialize<Answer>(AnswerOutput);
}
}

Просмотреть файл

@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>SerializerBenchmark</AssemblyName>
<RootNamespace>Benchmark</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.11.3" />
<PackageReference Include="Ceras" Version="4.0.27" />
<PackageReference Include="FsPickler" Version="5.2.0" />
<PackageReference Include="Hyperion" Version="0.9.8" />
<PackageReference Include="Jil" Version="2.16.0" />
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
<PackageReference Include="protobuf-net" Version="2.4.0" />
<PackageReference Include="SpanJson" Version="2.0.7" />
<PackageReference Include="Utf8Json" Version="1.3.7" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MessagePack\MessagePack.csproj">
<Aliases>newmsgpack</Aliases>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="MessagePack_1_7_3_6">
<HintPath>MessagePack_1_7_3_6.dll</HintPath>
<Aliases>oldmsgpack</Aliases>
<Private>true</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,24 @@
using Benchmark.Serializers;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
public class BinaryFormatter_ : SerializerBase
{
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
{
return (T)new BinaryFormatter().Deserialize(ms);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
new BinaryFormatter().Serialize(ms, input);
ms.Flush();
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
using Benchmark.Serializers;
public class Ceras_ : SerializerBase
{
Ceras.CerasSerializer ceras = new Ceras.CerasSerializer();
public override T Deserialize<T>(object input)
{
return ceras.Deserialize<T>((byte[])input);
}
public override object Serialize<T>(T input)
{
return ceras.Serialize(input);
}
}

Просмотреть файл

@ -0,0 +1,24 @@
using Benchmark.Serializers;
using System.IO;
using System.Runtime.Serialization;
public class DataContract_ : SerializerBase
{
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
{
return (T)new DataContractSerializer(typeof(T)).ReadObject(ms);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
new DataContractSerializer(typeof(T)).WriteObject(ms, input);
ms.Flush();
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
using Benchmark.Serializers;
using MBrace.FsPickler;
using System.IO;
public class FsPickler_ : SerializerBase
{
static readonly BinarySerializer serializer = MBrace.FsPickler.FsPickler.CreateBinarySerializer();
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
{
return serializer.Deserialize<T>(ms);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
serializer.Serialize<T>(ms, input);
ms.Flush();
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,56 @@
//using Benchmark.Serializers;
//using System.Buffers;
//using Hagar;
//using Hagar.Buffers;
//using Hagar.Session;
//using Microsoft.Extensions.DependencyInjection;
//using System.IO.Pipelines;
//public class Hagar_ : SerializerBase
//{
// readonly ServiceProvider serviceProvider;
// public Hagar_()
// {
// this.serviceProvider = new ServiceCollection()
// .AddHagar()
// .AddISerializableSupport()
// .AddSerializers(typeof(Hagar_).Assembly) // this assembly
// .BuildServiceProvider();
// }
// public override T Deserialize<T>(object input)
// {
// var serializer = serviceProvider.GetRequiredService<Serializer<T>>();
// var sessionPool = serviceProvider.GetRequiredService<SessionPool>();
// var pipe = new Pipe();
// pipe.Writer.WriteAsync((byte[])input).GetAwaiter().GetResult();
// pipe.Writer.Complete();
// using (var session = sessionPool.GetSession())
// {
// pipe.Reader.TryRead(out var readResult);
// var reader = new Reader(readResult.Buffer, session);
// var result = serializer.Deserialize(ref reader);
// return result;
// }
// }
// public override object Serialize<T>(T input)
// {
// var serializer = serviceProvider.GetRequiredService<Serializer<T>>();
// var sessionPool = serviceProvider.GetRequiredService<SessionPool>();
// var pipe = new Pipe();
// using (var session = sessionPool.GetSession())
// {
// var writer = pipe.Writer.CreateWriter(session);
// serializer.Serialize(ref writer, input);
// pipe.Writer.Complete();
// pipe.Reader.TryRead(out var result);
// return result.Buffer.ToArray();
// }
// }
//}

Просмотреть файл

@ -0,0 +1,26 @@
using Benchmark.Serializers;
using Hyperion;
using System.IO;
public class Hyperion_ : SerializerBase
{
static readonly Serializer serializer = new Hyperion.Serializer();
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
{
return serializer.Deserialize<T>(ms);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
serializer.Serialize(input, ms);
ms.Flush();
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,16 @@
using Benchmark.Serializers;
using Jil;
using System.Text;
public class Jil_ : SerializerBase
{
public override object Serialize<T>(T input)
{
return Encoding.UTF8.GetBytes(Jil.JSON.Serialize(input, Options.ISO8601));
}
public override T Deserialize<T>(object input)
{
return Jil.JSON.Deserialize<T>(Encoding.UTF8.GetString((byte[])input), Options.ISO8601);
}
}

Просмотреть файл

@ -0,0 +1,33 @@
using Benchmark.Serializers;
using Newtonsoft.Json;
using System.IO;
using System.Text;
public class JsonNet : SerializerBase
{
static readonly JsonSerializer serializer = new JsonSerializer();
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
using (var sr = new StreamReader(ms, Encoding.UTF8))
using (var jr = new JsonTextReader(sr))
{
return serializer.Deserialize<T>(jr);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
using (var sw = new StreamWriter(ms, Encoding.UTF8))
using (var jw = new JsonTextWriter(sw))
{
serializer.Serialize(jw, input);
}
ms.Flush();
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,56 @@
extern alias oldmsgpack;
extern alias newmsgpack;
using Benchmark.Serializers;
public class MessagePack_v1 : SerializerBase
{
public override T Deserialize<T>(object input)
{
return oldmsgpack::MessagePack.MessagePackSerializer.Deserialize<T>((byte[])input);
}
public override object Serialize<T>(T input)
{
return oldmsgpack::MessagePack.MessagePackSerializer.Serialize<T>(input);
}
}
public class MessagePack_v2 : SerializerBase
{
public override T Deserialize<T>(object input)
{
return newmsgpack::MessagePack.MessagePackSerializer.Deserialize<T>((byte[])input);
}
public override object Serialize<T>(T input)
{
return newmsgpack::MessagePack.MessagePackSerializer.Serialize<T>(input);
}
}
public class MessagePackLz4_v1 : SerializerBase
{
public override T Deserialize<T>(object input)
{
return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize<T>((byte[])input);
}
public override object Serialize<T>(T input)
{
return oldmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize<T>(input);
}
}
public class MessagePackLz4_v2 : SerializerBase
{
public override T Deserialize<T>(object input)
{
return newmsgpack::MessagePack.LZ4MessagePackSerializer.Deserialize<T>((byte[])input);
}
public override object Serialize<T>(T input)
{
return newmsgpack::MessagePack.LZ4MessagePackSerializer.Serialize<T>(input);
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using Benchmark.Serializers;
public class MsgPackCli : SerializerBase
{
public override T Deserialize<T>(object input)
{
return MsgPack.Serialization.MessagePackSerializer.Get<T>().UnpackSingleObject((byte[])input);
}
public override object Serialize<T>(T input)
{
return MsgPack.Serialization.MessagePackSerializer.Get<T>().PackSingleObject(input);
}
}

Просмотреть файл

@ -0,0 +1,23 @@
using Benchmark.Serializers;
using ProtoBuf;
using System.IO;
public class ProtobufNet : SerializerBase
{
public override T Deserialize<T>(object input)
{
using (var ms = new MemoryStream((byte[])input))
{
return Serializer.Deserialize<T>(ms);
}
}
public override object Serialize<T>(T input)
{
using (var ms = new MemoryStream())
{
Serializer.Serialize(ms, input);
return ms.ToArray();
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
using System;
namespace Benchmark.Serializers
{
public abstract class SerializerBase
{
public abstract object Serialize<T>(T input);
public abstract T Deserialize<T>(object input);
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using Benchmark.Serializers;
public class SpanJson_ : SerializerBase
{
public override object Serialize<T>(T input)
{
return SpanJson.JsonSerializer.Generic.Utf8.Serialize(input);
}
public override T Deserialize<T>(object input)
{
return SpanJson.JsonSerializer.Generic.Utf8.Deserialize<T>((byte[])input);
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using Benchmark.Serializers;
public class Utf8Json_ : SerializerBase
{
public override object Serialize<T>(T input)
{
return Utf8Json.JsonSerializer.Serialize(input);
}
public override T Deserialize<T>(object input)
{
return Utf8Json.JsonSerializer.Deserialize<T>((byte[])input);
}
}

Просмотреть файл

@ -11,10 +11,17 @@
<Title>MessagePack for C#</Title>
<Description>Extremely Fast MessagePack(MsgPack) Serializer for C#(.NET, .NET Core, Unity, Xamarin).</Description>
<PackageTags>MsgPack;MessagePack;Serialization;Formatter;Serializer;Unity;Xamarin</PackageTags>
<AssemblyName>MessagePack</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Remove="bin\**" />
<Compile Remove="obj\**" />
<EmbeddedResource Remove="bin\**" />
<EmbeddedResource Remove="obj\**" />
<None Remove="*.meta" />
<None Remove="bin\**" />
<None Remove="obj\**" />
<None Remove="Resolvers\*.meta" />
<None Remove="Internal\*.meta" />
<None Remove="Formatters\*.meta" />