Niclas Hedhman wrote:
> Rickard,
> You mention before that we could optimize a lot if we could get hold
> of the Method index, and stick it into an array for quick lookup
> instead of the hashmap now in place. You wanted to use some other
> bytecode manipulator for it.

Actually, it is CGLIB I wanted to use for it, which has this built-in.

> Perhaps the "slot" field in the java.lang.reflect.Method class could
> help. It holds the index of the method in the declared class. Not sure
> if still problematic, as I suspect it could become a question of
> "which interface" instead, but I thought I mention it just in case
> anyway.

Interesting idea! I made a quick test, but unfortunately there are two 
problems:
1) "slot" is private, so I have to use reflection to get it -> slow
2) it is the slot in the interface, and a composite may have several 
interfaces, so the slot "0" is going to be duplicated many times, so 
it's not possible to use it for lookup.

With CGLIB one essentially creates a proxy that holds one invoker per 
method, so when the invoker is called you know exactly which method is 
being dispatched. The invoker holds on to the CompositeMethodModel, and 
so no lookup whatever is done... faaaast...

/Rickard

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to