MethodClosure (BCEL Delegator implementation)

Chris Nokleberg <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.apps.devel,gmane.comp.jakarta.avalon.devel
Message-ID <20021221085019.GF252@shorty>
Hi!

FYI, I've checked in a MethodClosure class to the CGLIB project
(cglib.sf.net). It works almost exactly like the Delegator class in
excalibur, but is implemented using BCEL (like everything in CGLIB). The
primary benefit is performance; here are some quick numbers, all
delegating to String.indexOf(String, int):

 Time to create 100,000 delegates (ms)
    avalon:  4957
    cglib:     94

 Time to make 2,000,000 method calls (ms)
    avalon:  1366
    cglib:    136
    java:     105

It is also possible to use CGLIB as an almost drop-in replacement for
JDK 1.3 dynamic proxies, but as in this case you can often get *much*
better performance through a generated class tailored to the specific
application.

Regards,
Chris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.