Beispiel #1
0
        /// <summary>
        /// JSON序列化测试
        /// </summary>
        /// <param name="value"></param>
        static void Json(propertyData value)
        {
            string[]       jsons = new string[count];
            propertyData[] datas = new propertyData[count];
            Stopwatch      time  = new Stopwatch();

            time.Start();
            for (int index = count; index != 0;)
            {
                --index;
                jsons[index] = fastCSharp.emit.jsonSerializer.ToJson(value);
            }
            time.Stop();
            Console.WriteLine((count / 10000).toString() + "W object Property ToJson " + time.ElapsedMilliseconds.ToString() + "ms");

            time.Reset();
            time.Start();
            for (int index = count; index != 0;)
            {
                --index;
                datas[index] = fastCSharp.emit.jsonParser.Parse <propertyData>(jsons[index]);
            }
            time.Stop();
            Console.WriteLine((count / 10000).toString() + "W object Property Parse " + time.ElapsedMilliseconds.ToString() + "ms");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            do
            {
                propertyData propertyData = fastCSharp.emit.random <propertyData> .Create(randomConfig);

                Json(propertyData);

                codeFiledData filedData = fastCSharp.emit.random <codeFiledData> .Create(randomConfig);

                Json(filedData);

                XmlSerialize(filedData);

                IndexSerialize(filedData);
                Serialize(filedData);
                CodeSerialize(filedData);

                Console.WriteLine("Press quit to exit.");
            }while (Console.ReadLine() != "quit");
        }