原来的序列化使用微软的。可是接口、内部类无法序列化,根本没法用。

后来使用了自己的xml技术+反射,可是性能非常的垃圾。

于是用了1天时间写了个emit框架,性能大幅度提升!

 

对比结果:

        public void test002()
        {
            MyPojo2 pojo 
= CreateMyPojo();

            StartTest(
"Begin CreateObjectUsingReflection");

            
for (int i = 0; i < 50000; i++)
            {
                
object content = Pixysoft.IO.XmlExporter.Instance.XmlSerialize(pojo);
            }

            EndTest(
"Begin CreateObjectUsingReflection");

            StartTest(
"Begin CreateObjectUsingReflection");

            
for (int i = 0; i < 50000; i++)
            {
                
object content = XmlManager.Serialize(pojo);
            }

            EndTest(
"Begin CreateObjectUsingReflection");

            StartTest(
"Begin CreateObjectUsingReflection");

            
for (int i = 0; i < 50000; i++)
            {
                
object content = XmlManager.DynamicSerialize(pojo);
            }

            EndTest(
"Begin CreateObjectUsingReflection");

            StartTest(
"Begin CreateObjectUsingReflection");

            
for (int i = 0; i < 50000; i++)
            {
                
object content = DirectSerialize(pojo);
            }

            EndTest(
"Begin CreateObjectUsingReflection");
        }

相关文章:

  • 2022-02-07
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-03
  • 2021-09-07
  • 2021-12-04
  • 2021-09-02
  • 2021-10-11
  • 2021-08-22
  • 2021-08-20
相关资源
相似解决方案