Emit code performance is optimized.

Source: Internet
Author: User

Performance Comparison before optimization:

 

Object get dummy structure comparison

Objectwithvalueandattribute P = new objectwithvalueandattribute ();

100000

 

------ Test started: Assembly: pixysoft. Framework. reflection. dll ------

Reflection
Time elapsed: 4,589 Ms
CPU time: 4,015,625,000 NS
Gen 0: 484
Gen 1: 0
Gen 2: 0

Emit direct call Handler
Time elapsed: 1,406 Ms
CPU time: 1,359,375,000 NS
Gen 0: 1067
Gen 1: 0
Gen 2: 0

Emit with handler Cache
Time elapsed: 1,589 Ms
CPU time: 1,562,500,000 NS
Gen 0: 1080
Gen 1: 0
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 7.80 seconds (ad hoc ).

 

 

Serialization performance comparison:

Objectwithvalue pojo = createmypojo ();

5000

------ Test started: Assembly: pixysoft. Framework. configurations. dll ------

XML serialize
Time elapsed: 877 Ms
CPU time: 859,375,000 NS
Gen 0: 64
Gen 1: 0
Gen 2: 0

Dynamic serialize
Time elapsed: 395 Ms
CPU time: 375,000,000 NS
Gen 0: 238
Gen 1: 1
Gen 2: 0

Direct serialize
Time elapsed: 94 Ms
CPU time: 93,750,000 NS
Gen 0: 139
Gen 1: 0
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 1.47 seconds (ad hoc ).

 

Deserialization Performance Comparison

Objectwithvalue pojo = createmypojo ();

5000

 

------ Test started: Assembly: pixysoft. Framework. configurations. dll ------

XML deserialize
Time elapsed: 916 Ms
CPU time: 890,625,000 NS
Gen 0: 60
Gen 1: 0
Gen 2: 0

Dynamic deserialize
Time elapsed: 359 Ms
CPU time: 359,375,000 NS
Gen 0: 179
Gen 1: 0
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 1.44 seconds (ad hoc ).

 

Deserialization Performance Comparison

Objectwithcollecton pojo = createmypojo3 ();

500

 

------ Test started: Assembly: pixysoft. Framework. configurations. dll ------

XML deserialize
Time elapsed: 1,688 Ms
CPU time: 1,671,875,000 NS
Gen 0: 121
Gen 1: 0
Gen 2: 0

Dynamic deserialize
Time elapsed: 233 Ms
CPU time: 218,750,000 NS
Gen 0: 42
Gen 1: 0
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 2.14 seconds (ad hoc ).

 

Plug-in Performance Comparison

Iperson P = new person ();

500

 

------ Test started: Assembly: pixysoft. Framework. plugins. dll ------

XML deserialize
Time elapsed: 24,890 Ms
CPU time: 17,937,500,000 NS
Gen 0: 1497
Gen 1: 2
Gen 2: 0

Proxy deserialize
Time elapsed: 9,447 Ms
CPU time: 3,390,625,000 NS
Gen 0: 441
Gen 1: 1
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 35.08 seconds (ad hoc ).

 

Remoting Performance Comparison

Iremotingvalue value = pixysoft. Tools. pojohelper. getpojo <iremotingvalue> ();

500

------ Test started: Assembly: pixysoft. Framework. remoting. dll ------

Reflect
Time elapsed: 7,236 Ms
CPU time: 2,125,000,000 NS
Gen 0: 155
Gen 1: 0
Gen 2: 0

Dynamic
Time elapsed: 7,520 Ms
CPU time: 1,765,625,000 NS
Gen 0: 130
Gen 1: 0
Gen 2: 0

1 passed, 0 failed, 0 skipped, took 14.95 seconds (ad hoc ).

 

 

Summary:

This meaningless optimization wasted three hours. The original performance problem is in the log. It takes 1.6 seconds to enable logging.

And optimizedCodeOnly from 0.5 ms-> 0.1 Ms. The resolution is 0.4 milliseconds. Almost no optimization ..

It seems that a powerful profiler tool is needed.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.