Aug 28th, 2008, 02:51 PM
Is LTW a practical solution to prototype beans performance issues?
Here is the context: i have been refactoring a Swing rich client MMI (talking to a Stateful session bean deployed on JBoss) using Swing 2.5 for dependency injection and AOP (AspectJ style). For instance my PresentationElements (roughly the lines of a JTable) and Commands are prototype beans. I am happy with the results and cleanness, but for one thing.
The problem: the PresentationElements make heavy use of AOP and i get from JProbe that on a big cut and paste from Excel into the JTables (so in the end many entities will be created), two things take a lot of time:
-the creation of many proxyfied prototype beans
-the many invocations of AopUtils methods for matching invocations to JoinPoints
I thought maybe it would be a good idea to try LTW since you would gain time on both, and when i run a test comparing the creation of 10000 prototype beans and the invocation of a matching method, with LTW or runtime dynamic proxies, using LTW is about 30% faster. Prototype beans are not intrinsically slower buti create a lot of them.
Of course using LTW with the unit tests and application has been proving harder than running the doc example, even if i have noticed before posting this thread that ramnivas has posted some advice that seems like it might be useful. On that note it seems that a lot of users have had difficulties with injection into AspectJ aspects, maybe the doc could use a specific example regarding that.
I will try the ramnivas solutions of using aspectof (was is the doc but forgot it) and using XML injection instead of Resource, but before i spend more time investigating i wanted to know whether the LTW endeavour was worth it, even if so far i only use it for performance reasons (no Configurable), or is it a misguided attempt?
Or should i investigate build-time weaving? Any realistic options that don't change too much my current beans and aspects?
Or maybe use some sort of prototype beans pooling?
Last edited by chtimi; Aug 28th, 2008 at 02:55 PM.
Sep 9th, 2008, 04:47 PM
It's a bug!
h t t p ://jira.springframework.org/browse/SPR-5138