[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] Slow if()
- From: "Andy Clement" <andrew.clement@xxxxxxxxx>
- Date: Thu, 3 Jul 2008 09:18:55 -0700
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=l7wtx94QUJWta1wBmzwYvJpdRw7R6gkTMNPassg1L9pKCEBScmFQzlvcIZhY9u+2Da 6Gd3vGynatWqIC1U4stGXnesW6BJHRAaLqhEHIKe6t7edMC/fgJYTIGPRZVK3bhi+f52 6tRCBdvpvU75it29Z0oE2F6jYtMAJXUyGGt4Y=
I'm afraid that isn't possible right now. We do support an optimized
implementation of if() pcds that only builds thisJoinPoint if the if()
condition succeeds but if() can only use static information. (I'm
talking code style here rather than annotation style). I have thought
about improving that if() optimization for certain other situations
but haven't had the time to look into it yet - you could raise an
enhancement request where we could discuss it further in that.
Possibly I had been thinking about exposing the aspect instance for
use in the if(), maybe that plus a perthis() instantiation model would
help your situation.
2008/7/3 Marijn Meijles <marijn@xxxxxxxxxx>:
> I have a problem with my around advice. The advice itself is really slow
> because it does all kind of reflection stuff and needs access to this (the
> current aspected instance). However, it should only run about 1% of the time
> and that depends on the return value of a getter on this. Now my question
> is: how do I tell AspectJ to only run the advice and do all kinds of time
> consuming stuff if the value from the getter is not null?
> I tried a pointcut with "... && this(entity) && if()" whereby the method
> body returns "entity.getParent() != null" but this doesn't help, probably
> because the ProceedingJoinPoint is created for the @Pointcut method as well.
> Any help would be greatly appreciated.
> This line says this line says
> aspectj-users mailing list