简体   繁体   English

Java动态代理的性能成本

[英]Performance cost of Java dynamic proxy

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? 许多现代框架(Spring,Hibernate)使用Java动态代理提供了非常好的动态行为,但与之相关的确切性能成本是多少? Are there public benchmarks available for Sun JVM? 是否有针对Sun JVM的公共基准测试?

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). 我不知道你提到的框架中是否有任何性能分析,但在我的项目lambdaj中,我使用相同的技术(cglib)大量使用动态代理。 In the pdf that explains how my library works you can also find an interesting performance comparison on this subject. 在解释我的图书馆如何运作的pdf中,您还可以找到关于此主题的有趣的性能比较。

According to Remi Forax, java proxy forbid the Jit compiler to do correctly his job (inlining in this case). 根据Remi Forax的说法,java代理禁止Jit编译器正确完成他的工作(在这种情况下内联)。

See his rewrote of Proxy 看他的代理重写

https://github.com/forax/proxy2 https://github.com/forax/proxy2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM