Пример #1
0
        static void Main(string[] args)
        {
            {
                var ms = new MemoryStream();
                var t1 = new Packtest();
                ms.Reset();
                t1.Field9 = null;
                t1.Pack(ms);
                ms.Reset();
                t1.Unpack(ms);
            }
            return;

            var test1 = new SpeedTest(delegate()
            {
                var ms = new MemoryStream();
                var t1 = new Packtest();
                ms.Reset();
                t1.Pack(ms);
                ms.Reset();
                t1.Unpack(ms);
            });

            var test2 = new SpeedTest(delegate()
            {
                var ms = new MemoryStream();
                var t2 = new Packtest2();
                ms.Reset();
                t2.Pack(ms);
                ms.Reset();
                t2.Unpack(ms);
            });


            test2.Test();
            test1.Test();

            Console.WriteLine("My serialize class");
            Console.WriteLine("Min: {0}ms", test1.Min);
            Console.WriteLine("Avg: {0}ms", test1.Average);
            Console.WriteLine("Max: {0}ms", test1.Max);
            Console.WriteLine();
            Console.WriteLine("Binaryreader/writer");
            Console.WriteLine("Min: {0}ms", test2.Min);
            Console.WriteLine("Avg: {0}ms", test2.Average);
            Console.WriteLine("Max: {0}ms", test2.Max);

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            {
                var ms = new MemoryStream();
                var t1 = new Packtest();
                ms.Reset();
                t1.Field9 = null;
                t1.Pack(ms);
                ms.Reset();
                t1.Unpack(ms);
            }
            return;

            var test1 = new SpeedTest(delegate()
            {
                var ms = new MemoryStream();
                var t1 = new Packtest();
                ms.Reset();
                t1.Pack(ms);
                ms.Reset();
                t1.Unpack(ms);
            });

            var test2 = new SpeedTest(delegate()
            {
                var ms = new MemoryStream();
                var t2 = new Packtest2();
                ms.Reset();
                t2.Pack(ms);
                ms.Reset();
                t2.Unpack(ms);
            });

            test2.Test();
            test1.Test();

            Console.WriteLine("My serialize class");
            Console.WriteLine("Min: {0}ms", test1.Min);
            Console.WriteLine("Avg: {0}ms", test1.Average);
            Console.WriteLine("Max: {0}ms", test1.Max);
            Console.WriteLine();
            Console.WriteLine("Binaryreader/writer");
            Console.WriteLine("Min: {0}ms", test2.Min);
            Console.WriteLine("Avg: {0}ms", test2.Average);
            Console.WriteLine("Max: {0}ms", test2.Max);

            Console.ReadKey();
        }