Performance impact of using aop Performance impact of using aop spring spring

Performance impact of using aop


As long as you have control of your AOP I think it's efficient. We did have performance problems anyway, so by own reasoning we were not fully in control ;) This was mostly because it's important that anyone that writes aspects has full understanding of all the other aspects in the system and how they interrelate. If you start doing "smart" things you can outsmart yourself in a jiffy. Doing smart things in a large project with lots of people who only see small parts of the system can be very dangerous performance-wise. This advice probably applies without AOP too, but AOP lets you shoot yourself in the foot in some real elegant ways.

Spring also uses proxying for scope-manipluations and thats an area where it's easy to get undesired performance losses.

But given that you have control, the only real pain point with AOP is the effect on debugging.


If performance is going to be a concern, we have used AspectJ to great effect.

Because it uses bytecode weaving (compile time vs. runtime makes quite the difference) it's one of the fastest AOP frameworks out there. See: AOP Benchmarks


When I used it, I didn't - but then my application isn't your application.

If you use it for calls which are used in a very tight loop, there's the opportunity for a significant performance hit. If it's just used to check security once per request and cache various things, I can't see how it's likely to be significant - but that's why you should profile and benchmark your app.

I realise that "measure with your app" probably isn't the answer you were looking for, but it may well be the one you guessed you'd get :)