Loading...
 

PogamutUT2004


Performance of the new BotModuleController

Hi

I played a bit with the new BotModuleController and must say that I really like the wrappings you've added, although I suppose most of it is Pogamut-syntactic sugar :-)
In any case, it really cuts down on the overhead for introduction to new Pogamuters.

I was wondering though. I notice that you use reflection quite a lot with regards to the new Annotated listeners (a really fancy solution in my eyes).

This is of course not a performance problem in initialization, the overhead is negligible at this stage, but there's some reflective behavior in each listener's invocation as well (two Method.setAccesible and a Method.invoke).

I don't know much about reflection and was just wondering if any of you've tested how much overhead this generates?
This is just a question of curiosity, feel free to ignore this if there's something inherently stupid with the question :P

Cheers,
Simon
Hi Simon!

Good question indeed :-)

In our experience (we've do some testing) the reflection slows the invocation 20x times. But the method invocation is really fast
and it could not be really meassured as Java has a strange heartbeat when it comes to time (I was unable to precisly meassure it
but 20x is the good guess). The trick is that the usual invocation is quite fast and we never had a problem with reflection at all.

I've already built one decision making framework based solely on reflection and everything was ok even when I've run several bots
in one JVM (around 100*5 reflection invocation per second for one bot). So I would not fear of that.

But anybody pursuing the better performance may use the old fashion way registering his/her own listener to the worldview.

Cheers!
Jimmy
Thanks for clearing that up :-)

I was just preemptively curious and felt that spending time creating an accurate test was pointless if someone else had already done so. To be honest, I didn't expect it to be problematic but given that I've already implemented listeners using the old approach, I'll just stick with it.

But I like how you've implemented it and might use the approach for something else in the future :-)

Cheers,
Simon
Thanks :-)

There is one catch though ... AnnotationListenerRegistrator does not take inheritance into an account.
Therefore do not rely on it if you inherit your behavior module / controller.

This might change in the future (I know how to do it, but it will be big ugly piece of code
that would have to introspect all parents classes of the given class and do the correct prioritization of
listener annotations).

Cheers!
Jimmy
Glad for the comment, that probably saved me some frustration if I decided to give the AnnotationListeners a try. I am in fact using an extra level of inheritance at the moment :-)

Cheers,
Simon
Glad to help :-)

It would be messy if you do that.

I will probably implement it after 3-4 months. For now I'm still bugfixing the GaviLib (the core).

Cheers!
Jimmy
 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.