Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance Overhead of AOP

I was wondering if there are any major performance issues with using AspectJ if it is being used to intercept every (or just most) method in an application. Of course, performance would also be affected by the advice that got executed on every interception.

For the sake of this example, let's say its very simple advice that runs very quickly and with minimal overhead/no memory leaks. Are there still significant performance killers since every method is being intercepted?

like image 924
IAmYourFaja Avatar asked Jan 16 '12 13:01

IAmYourFaja


1 Answers

It certainly won't accelerate your code. I've seen horrible results where 19 stackframes had been added between a caller and a callee for an otherwise direct rapid event handling method. Suffice to say AOP is dead in my mind.

If you are lucky, you may have compiled code, which is inlined by the jit compiler and merely adds the actual work you chose to add as if you wrote it in place. Worst cases, like the spring/osgi crap out there, you end up with some unusable snail.

like image 62
user2023577 Avatar answered Sep 23 '22 18:09

user2023577