This may have been covered before, but one of the guys working on the fortress port
of our stuff just pointed out to me how bad reflection/the proxy objects actually are for performance..
With proxy objects, we're pretty much loosing a *factor* of 5-10 in performance (for each
method call on a component)...
I've disabled proxies by using following container:
public class NoProxyContainer extends DefaultContainer {
protected ObjectFactory createObjectFactory( final String classname,
final Configuration configuration ) throws ClassNotFoundException {
final Class clazz = m_classLoader.loadClass( classname );
final ComponentFactory componentFactory = new ComponentFactory( clazz, configuration,
m_serviceManager, m_context, m_loggerManager, m_extManager );
return componentFactory;
}
}
[running a single dummy method on a component in this container vs. the same
component in the DefaultContainer yields a 5-10 times increase in performance].
So, a couple of questions and suggestions:
1/ Q: exactly why are proxy objects used ? I can see one use, and that is preventing people from
accidentally calling lifecycle methods.. [which is by the way a really nifty feature, but see 3/].
2/ Q: is this the correct way of disabling proxy objects or are they used in other places as well ?
3/ S: if 1/ is correct, why don't we have a debug and a release mode of a container... Running
a container in debug mode would enable the container to use proxies and allow the developer
to test his code properly -- running in release mode would use the regular componentfactory
and have no penalty.. There's really no need for checking the lifecycle methods usage at
runtime in a release system..(afaik.. ;-) ).
4/ S: if this is correct, I think at least adding a warning about this behaviour and how to disable
it would be good (in the documentation e.g.)... Would be happy to take care of that if someone
points me to the correct location...
Please let me know if I'm missing something...
- Filip
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
