コード例 #1
0
        public static void TestCase4()
        {
            TestBaseConfig.Seed = 1;
            MixClass a = MixClass.Init();

            byte[]    buffer = ShiboSerializer.BinarySerialize(a);
            MixClass  b      = ShiboSerializer.BinaryDeserialize <MixClass>(buffer);
            Stopwatch w      = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                buffer = ShiboSerializer.BinarySerialize(a);
                //b = ShiboSerializer.BinDeserialize<MixClass>(buffer);
            }
            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds);
            Console.WriteLine(JsonConvert.SerializeObject(a) == JsonConvert.SerializeObject(b));
        }
コード例 #2
0
        public static void TestCase4()
        {
            TestBaseConfig.Seed = 1;
            MixClass a    = MixClass.Init();
            string   json = ShiboSerializer.Serialize(a);
            MixClass b    = ShiboSerializer.Deserialize <MixClass>(json);

            //Test(a);

            Stopwatch w = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //JsonConvert.SerializeObject(a);
                //ShiboSerializer.Serialize(a);
                b = ShiboSerializer.Deserialize <MixClass>(json);
                //b = JsonConvert.DeserializeObject<MixClass>(json);
            }
            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds);
            Console.WriteLine(JsonConvert.SerializeObject(a) == JsonConvert.SerializeObject(b));
        }