Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ Performance

Hello All

We are currently evaluating the possibility of using AspectJ for the debug
logging component of our project. One of the major requirements is that
there should be minimal performance impact when the debug logging component
is turned off. I was doing some performance testing with AspectJ and it
seems like there is a 35% - 50% decrease in performance after the aspects
are woven into our classes.

My benchmark pretty much just measures the number of calls to a method that
increments a integer 1000 times. Without the aspects, we would see around
470 calls/ms. With an advice that has an entry and exit pointcut just for
that method woven in, we see around 300 calls/ms. Each pointcut only
contains an if statement that always evaluate to false to simulate logging
turned off.

Digging in to the woven code, I noticed ajc inserted the following code
right after the method signature:

org.aspectj.lang.JoinPoint joinpoint = Factory.makeJP(ajc$tjp_0, this,
this);

This seems to be an expensive operation, especially for every method entry.
Are there any ways to speed up this case so that AspectJ adds as little
overhead as possible when the pointcut doesn't do anything? It would be
ideal if there was a way to control executing expensive operations like the
one above so that they are done only when necessary.

Thank you for your help!

Bo Li - b.li@xxxxxxx
Software Engineer - Directory Server
Sun Microsystems Inc.




Back to the top