Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Mixing post-compile and load-time weaving

Ron Bodkin wrote On 10/11/06 10:18,:

For what it’s worth, we also mix build-time and load-time weaving with Glassbox. To gain performance with load-time weaving we:

 

1. Guard pointcuts using within(TypePattern+) && … - this lets AspectJ do fast matching. This is a big gain if many classes do not need to be woven.

2. Use <weaver><include within=”TypePattern+”/></weaver> in the aop.xml file to consistently hoist the fast matching (it’s surprising that this gains performance over #1 but it definitely does … at some point I hope to investigate why this happens).

3. Exclude weaving into statically woven Glassbox code using <weaver><exclude within=”…”/>…, primarily to avoid exposing a large number of internal aspects that need to be potentially woven against external code. We started doing this before –outxml was available for maintainability reasons and also before using the first two approaches, so hopefully we could stop doing this and still achieve good performance.

4. Exclude weaving into known sets of code where our aspects don’t apply (server internals) also using exclude

 

Naturally, I would like if none of the above were needed: if fast matching would handle #1, we didn’t need any additional hints in the aop.xml file from #2 and probably #3 is already a minor performance gain. But if you want to see a real world example of minimizing start-up overhead with AspectJ LTW, it’s worth looking at how we do this.

Thanks, that is very helpful. An example of this kind of thing is what I was hoping to find in the docs. I had also assumed that the aop.xml file that was generated would mimic the matching rules that I have in my compile-time aspects. I have determined that if I run using the post-compile-woven classes and load time weaving and the vanilla aop.xml file, my app crashes with a null pointer exception suggesting that the double weaving is buggy. I'll experiment with more controls in the aop.xml file.

Mick


Back to the top