コード例 #1
0
ファイル: Program.cs プロジェクト: blqw/blqw.Json
        static void Test2()
        {
            //var json1 = blqw.Json.ToJsonString(User.TestUser());
            var json2 = File.ReadAllText("json1.txt");
            var json3 = File.ReadAllText("json2.txt");

            //TimeTest.TestCount = 1000;
            //TimeTest.TestJsonString = json1;
            //TimeTest.TestQuickJsonBuilder<User>();
            //TimeTest.TestFastJson<User>();

            //Console.WriteLine("========================");
            //TimeTest.TestCount = 200;
            //TimeTest.TestJsonString = json2;
            //TimeTest.TestQuickJsonBuilder<ResultDTO>();
            //TimeTest.TestFastJson<ResultDTO>();

            Console.WriteLine("========================");;
            TimeTest.TestCount      = 500;
            TimeTest.TestJsonString = json3;
            TimeTest.TestQuickJsonBuilder <List <Object2> >();
            TimeTest.TestFastJson <List <Object2> >();

            //var obj2 = Newtonsoft.Json.JsonConvert.DeserializeObject<ResultDTO>(jsonStr);
            //var jsonStr1 = blqw.Json.ToJsonString(obj1);

            //Class1.AssertEquals(obj1, obj2);
        }
コード例 #2
0
        public static void SerializeTest(int count, object obj)
        {
            TimeTest.TestCount  = count;
            TimeTest.TestObject = obj;

            TimeTest.TestQuickJsonBuilder();
            TimeTest.TestFastJson();
            TimeTest.TestJavaScriptSerializer();
            TimeTest.TestJayrockJson();
            TimeTest.TestNewtonsoftJson();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: blqw/blqw.Json
        public static void Test1(bool fastjson)
        {
            var obj1 = User.TestUser();
            var obj2 = Json.ToObject <ResultDTO>(File.ReadAllText("json1.txt"));
            var obj3 = Json.ToObject <List <Object2> >(File.ReadAllText("json2.txt"));

            TimeTest.TestCount  = 100000 * 5;
            TimeTest.TestObject = obj1;
            TimeTest.TestQuickJsonBuilder();
            TimeTest.TestCrylwJson();
            if (fastjson)
            {
                TimeTest.TestFastJson();
            }

            Console.WriteLine("========================");
            TimeTest.TestCount  = 2000 * 5;
            TimeTest.TestObject = obj2;
            TimeTest.TestQuickJsonBuilder();
            TimeTest.TestCrylwJson();
            if (fastjson)
            {
                TimeTest.TestFastJson();
            }

            Console.WriteLine("========================");;
            TimeTest.TestCount  = 250 * 5;
            TimeTest.TestObject = obj3;
            TimeTest.TestQuickJsonBuilder();
            TimeTest.TestCrylwJson();
            if (fastjson)
            {
                TimeTest.TestFastJson();
            }

            //var obj2 = Newtonsoft.Json.JsonConvert.DeserializeObject<ResultDTO>(jsonStr);
            //var jsonStr1 = blqw.Json.ToJsonString(obj1);

            //Class1.AssertEquals(obj1, obj2);
        }