Skip to main content

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

Hello Andy

thank you Andy for you reply and explanation.

You are correct, it won't - did you read somewhere that it would?  Did
we have some documentation that said around advice was supported for
the lazytjp optimization?
  
I don't know where exactly I first read about if() construct, that it can give you better performance. Maybe it wasn't writen clearly that it doesn't work with around advice, maybe I got it wrong.

I'd like to use it that way and I would be very happy to see it as an enhancement in one of future releases.
I raised an enhancement request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=311749

I'm looking forward :)

Peter

On 4. 5. 2010 17:49, Andy Clement wrote:
Hi Peter,

Unfortunately the 'lazytjp' optimization, which is what you are trying
to activate (where the if() guards joinpoint construction) is not
currently supported for around advice.

=== A.java ===
public class A {
  public void m() {
  }
}

aspect X {
  void around(): execution(* m(..)) && if(1==3) {
     System.out.println(thisJoinPoint);
  }
}
======
  
ajc -1.5 A.java -Xlint:warning
    
A.java:2 [warning] can not implement lazyTjp on this joinpoint
method-execution(void A.m()) because around advice is used [Xlint:
canNotImplementLazyTjp]
public void m() {
^^^^^^^^^^^^^^^^^
        [Xlint:canNotImplementLazyTjp]
        see also: A.java:7::0

1 warning

  
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.
    
You are correct, it won't - did you read somewhere that it would?  Did
we have some documentation that said around advice was supported for
the lazytjp optimization?

You can raise an enhancement request if you like.  I had a look
through the archives and couldn't find one already open
(surprisingly).

cheers,
Andy

2010/5/4 Peter Kvokacka <kvokacka@xxxxxxxxx>:
  
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

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


    
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

  


Back to the top