Alois-xx / SerializerTests

.NET Serializer testing framework
76 stars 22 forks source link

New serializer #8

Closed jonathanbyrne closed 5 years ago

jonathanbyrne commented 5 years ago

I love your benchmark and have used it in the past to select the best serializer for a project. I have been frustrated with the limitations of other serializers so I wrote my own over the past weekend.

https://github.com/Byrne-Labs/Serializer https://www.nuget.org/packages/ByrneLabs.Serializer

Advantages:

Disadvantages

jonathanbyrne commented 5 years ago

Also, here is the test harness for your project in case you want to take a look.

using System;
using System.IO;
using System.Runtime.CompilerServices;
using ByrneLabs.Serializer;

namespace SerializerTests.Serializers
{
    public class ByrneLabs<T> : TestBase<T, Formatter> where T : class
    {
        public ByrneLabs(Func<int, T> testData, Action<T> dataToucher) : base(testData, dataToucher)
        {
            FormatterFactory = () => new Formatter();
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        protected override T Deserialize(Stream stream) => (T) Formatter.Deserialize(stream);

        [MethodImpl(MethodImplOptions.NoInlining)]
        protected override void Serialize(T obj, Stream stream)
        {
            Formatter.Serialize(stream, obj);
        }
    }
}
Alois-xx commented 5 years ago

Hi Jonathan,

thanks for taking the effort to add your serializer. To keep the test suite useful I have stated in the main page

If I have forgot a great serializer (should be as fast or faster than Protobuf) please drop me a note and I will include it.

I know that this is a pretty high bar to reach but there are so many serializers out there I want to compare only the fastest ones. Otherwise my Excel chart will become unreadable if 20 more serializer show up. I already have to consider to remove less prominent ones in favor of faster and newer ones.