Performance cost of Java dynamic proxy

天涯浪子 提交于 2019-12-03 01:21:37

问题


Many modern frameworks (Spring, Hibernate) provide very nice dynamic behaviors with use of Java dynamic proxies, but what's the exact performance cost associated with it? Are there public benchmarks available for Sun JVM?


回答1:


A few pointers:

  • Debunking myths: proxies impact performance (have a look at the comments too)
  • Java theory and practice: Decorating with dynamic proxies
  • Benchmarking the cost of dynamic proxies



回答2:


I don't know if there is any performance analysis in the framework you mentioned, but in my project lambdaj I made a very large use of dynamic proxy using the same technology (cglib). In the pdf that explains how my library works you can also find an interesting performance comparison on this subject.




回答3:


According to Remi Forax, java proxy forbid the Jit compiler to do correctly his job (inlining in this case).

See his rewrote of Proxy

https://github.com/forax/proxy2



来源:https://stackoverflow.com/questions/1856242/performance-cost-of-java-dynamic-proxy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!