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?
+6
A:
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
Pascal Thivent
2009-12-06 19:15:46
Thanks for the links, especially for the last one that provides the real benchmark number: factor of 1.63 in raw use
Gennady Shumakher
2009-12-06 19:44:23
+4
A:
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.
Mario Fusco
2009-12-06 19:25:29
If I got it right your framework slows the iterations by average factor of 4.56, but would you relate it to the cglib proxies or to other elements of the library?
Gennady Shumakher
2009-12-06 20:07:20
The 2 things that mostly slow down the performance of lambdaj are cglib and reflection. My measurements shows that the second is just a bit more relevant than the first. So I suppose that roughly an invocation through cglib can be considered about twice slower than a normal one.
Mario Fusco
2009-12-06 20:59:29