1

Since AspecJ adds more logic to original code, I wanna know what's the overhead of applying AspectJ for different scenarios?

Is there any benchmark on this?

Thank a lot!

1
  • I know this one is old, but still listed as unanswered. Would you please accept and upvote my answer if it seems appropriate? Thanks.
    – kriegaex
    Jun 9, 2014 at 12:41

1 Answer 1

1

There is no general way to answer the question. It really depends on how broad or narrow the scope of your pointcuts is and how expensive the code executed in your advice is. Usually the overhead is small unless you use a very unfortunate combination of dynamically determined pointcuts and expensive/slow advice code to be woven into the target joinpoints.

Imagine you add a certain code snippet to many methods. The overhead depends on the snippet, the number of places you add the snippet to and the number of calls for all those methods where you added the code. This is what an aspect weaver does: weave compiled bytecode into your classes. The only difference is that it is done automatically, you do not have to scatter the snippets throughout your code base manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.