Beispiel #1
0
        public void SetUp()
        {
            var resolver = newmsgpack::MessagePack.Resolvers.CompositeResolver.Create(newmsgpack::MessagePack.Resolvers.PrimitiveArrayResolver.Instance, newmsgpack::MessagePack.Resolvers.StandardResolver.Instance);

            options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(resolver);

            zero     = new sbyte[Size];
            inputM33 = new sbyte[Size];
            inputM32 = new sbyte[Size];
            input    = new sbyte[Size];

            var r = new Random();

            r.NextBytes(MemoryMarshal.AsBytes(input.AsSpan()));
            for (var i = 0; i < inputM32.Length; i++)
            {
                inputM32[i] = -32;
                inputM33[i] = -33;
            }

            if (!oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input).SequenceEqual(newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options)))
            {
                throw new InvalidProgramException();
            }
        }
Beispiel #2
0
        public void SetUp()
        {
            var resolver = newmsgpack::MessagePack.Resolvers.CompositeResolver.Create(newmsgpack::MessagePack.Resolvers.PrimitiveArrayResolver.Instance, newmsgpack::MessagePack.Resolvers.StandardResolver.Instance);

            options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(resolver);

            inputFalse = new bool[Size];
            inputTrue  = new bool[Size];
            input      = new bool[Size];

            var r = new Random();

            for (var i = 0; i < inputTrue.Length; i++)
            {
                inputTrue[i] = true;
                input[i]     = r.Next(0, 2) == 0;
            }

            inputSerialized = newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options);

            if (!oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input).SequenceEqual(inputSerialized))
            {
                throw new InvalidProgramException();
            }
        }
Beispiel #3
0
 public StringKeyDeserializeCompare()
 {
     this.bin       = newmsgpack.MessagePack.MessagePackSerializer.Serialize(new StringKeySerializerTarget());
     this.binIntKey = newmsgpack.MessagePack.MessagePackSerializer.Serialize(new IntKeySerializerTarget());
     this.automata  = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(new Resolver(new GeneratedFormatter.MessagePack.Formatters.StringKeySerializerTargetFormatter_AutomataLookup()));
     this.hashtable = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(new Resolver(new GeneratedFormatter.MessagePack.Formatters.StringKeySerializerTargetFormatter_ByteArrayStringHashTable()));
 }
Beispiel #4
0
        public void SetUp()
        {
            var resolver = newmsgpack::MessagePack.Resolvers.CompositeResolver.Create(new newmsgpack::MessagePack.Formatters.IMessagePackFormatter[] { new newmsgpack::MessagePack.Formatters.UnsafeUnmanagedStructArrayFormatter <Matrix4x4>(50) }, new[] { newmsgpack::MessagePack.Resolvers.StandardResolver.Instance });

            options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(resolver);

            input = new Matrix4x4[Size];
            var r = new Random();

            for (var i = 0; i < input.Length; i++)
            {
                input[i] = new Matrix4x4((float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble(), (float)r.NextDouble());
            }

            inputSerializedUnsafe = newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options);
            inputSerializedNormal = newmsgpack::MessagePack.MessagePackSerializer.Serialize(input);
        }
Beispiel #5
0
        public void SetUp()
        {
            var resolver = newmsgpack::MessagePack.Resolvers.CompositeResolver.Create(newmsgpack::MessagePack.Resolvers.PrimitiveArrayResolver.Instance, newmsgpack::MessagePack.Resolvers.StandardResolver.Instance);

            options = newmsgpack::MessagePack.MessagePackSerializerOptions.Standard.WithResolver(resolver);
            input   = new float[Size];

            var r = new Random();

            for (var i = 0; i < input.Length; i++)
            {
                input[i] = (float)r.NextDouble();
            }

            if (!oldmsgpack::MessagePack.MessagePackSerializer.Serialize(input).SequenceEqual(newmsgpack::MessagePack.MessagePackSerializer.Serialize(input, options)))
            {
                throw new InvalidProgramException();
            }
        }
            public global::PerfBenchmarkDotNet.StringKeySerializerTarget Deserialize(ref MessagePackReader reader, newmsgpack::MessagePack.MessagePackSerializerOptions options)
            {
                if (reader.TryReadNil())
                {
                    return(null);
                }

                var length = reader.ReadMapHeader();

                var __MyProperty1__ = default(int);
                var __MyProperty2__ = default(int);
                var __MyProperty3__ = default(int);
                var __MyProperty4__ = default(int);
                var __MyProperty5__ = default(int);
                var __MyProperty6__ = default(int);
                var __MyProperty7__ = default(int);
                var __MyProperty8__ = default(int);
                var __MyProperty9__ = default(int);

                for (int i = 0; i < length; i++)
                {
                    ReadOnlySequence <byte> stringKey = reader.ReadStringSegment();
                    int key;
                    if (!this.keyMapping.TryGetValue(stringKey, out key))
                    {
                        reader.Skip();
                        continue;
                    }

                    switch (key)
                    {
                    case 0:
                        __MyProperty1__ = reader.ReadInt32();
                        break;

                    case 1:
                        __MyProperty2__ = reader.ReadInt32();
                        break;

                    case 2:
                        __MyProperty3__ = reader.ReadInt32();
                        break;

                    case 3:
                        __MyProperty4__ = reader.ReadInt32();
                        break;

                    case 4:
                        __MyProperty5__ = reader.ReadInt32();
                        break;

                    case 5:
                        __MyProperty6__ = reader.ReadInt32();
                        break;

                    case 6:
                        __MyProperty7__ = reader.ReadInt32();
                        break;

                    case 7:
                        __MyProperty8__ = reader.ReadInt32();
                        break;

                    case 8:
                        __MyProperty9__ = reader.ReadInt32();
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }

                var ____result = new global::PerfBenchmarkDotNet.StringKeySerializerTarget();

                ____result.MyProperty1 = __MyProperty1__;
                ____result.MyProperty2 = __MyProperty2__;
                ____result.MyProperty3 = __MyProperty3__;
                ____result.MyProperty4 = __MyProperty4__;
                ____result.MyProperty5 = __MyProperty5__;
                ____result.MyProperty6 = __MyProperty6__;
                ____result.MyProperty7 = __MyProperty7__;
                ____result.MyProperty8 = __MyProperty8__;
                ____result.MyProperty9 = __MyProperty9__;
                return(____result);
            }
 public void Serialize(ref MessagePackWriter writer, global::PerfBenchmarkDotNet.StringKeySerializerTarget value, newmsgpack::MessagePack.MessagePackSerializerOptions options)
 {
     throw new NotImplementedException();
 }