Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] around advice and if() construct

Hello guys
I'd like to ask whether using the if() construct in a pointcut for an around advice, give me a better performance or not?

I decompiled a woven class and saw:
    public void test() throws Exception
    {
        JoinPoint joinpoint = Factory.makeJP(ajc$tjp_0, this, this);
        if(TestAspect.ajc$if$806(ajc$tjp_0))
        {
            test_aroundBody1$advice(this, joinpoint, ajc$test_TestAspect$localAspectOf(), null, ajc$tjp_0, joinpoint);
            return;
        } else
        {
            test_aroundBody0(this, joinpoint);
            return;
        }
    }

If I understand it correctly
    JoinPoint joinpoint = Factory.makeJP(ajc$tjp_0, this, this);
has biggest impact on a performance (except method body), but it is before
        if(TestAspect.ajc$if$806(ajc$tjp_0))
which is actually the test I wrote to the if() construct in TestAspect:
Object around() throws Exception : testMethods() && if (...) {
    ..
}
I would expect that the test will appear before Factory.makeJP and thus we gain a performance improvement by using the if() construct.

I don't know if I understand it correctly, but it seems to me that use of  if() construct with around advice doesn't give me better performance at all.
Did I miss something? What do you think?

Peter

Back to the top