On 22/10/2014 09:26, Peter Levart wrote:
On 10/20/2014 11:25 AM, Cédric Champeau wrote:
For what it's worth, in Groovy, we have two separate pathes to "implement
classes at runtime", that is to say generating proxies. In the case of an
interface, we rely on the JDK proxy just because it is *much* faster than
generating a class through ASM. I mean that generating a class in ASM is
orders of magnitude slower (at least in our case) than relying on the JDK
proxy adapters. Of course, it then depends on how often the method is
called, because at some point a generated class will be faster, but so far,
the choice we made is better in practice, because lots of people do not
realize that if they do "foo as SomeInterface" in a loop, they are
generating a new proxy for each call...

New proxy instance, not proxy class, right?
Correct.
j.l.r.Proxy API has a cache and only creates one Proxy class for a particular list of interfaces...

I agree that sun.misc.ProxyGenerator can be much faster at generating new class than ASM. But it's also more difficult to program/change. So it depend on what changes would be necessary...

That I can't comment :-)
Regards, Peter


--
Cédric Champeau
SpringSource - Pivotal
http://twitter.com/CedricChampeau
http://melix.github.io/blog
http://spring.io/ http://www.gopivotal.com/

_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to