Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Is there any performance issue usingthisJoinPoint

 
Just another question about the if statement in the pointcut:
does the order matter ?
before(): execution(* *(..)) && if(GlobalLoggingFlagIsTrue);
And
before():  if(GlobalLoggingFlagIsTrue) && execution(* *(..)) ;
have the same cost, when matching ?

Cordialement / Best regards

Jean-Louis Pasturel



-----Message d'origine-----
De : aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Andy Clement
Envoyé : mercredi 22 décembre 2010 18:43
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] Is there any performance issue
usingthisJoinPoint

Hi Marko,

Yes, there is a cost for building thisJoinPoint objects - elements like the
arguments have to be packaged up at the advised site so they can be passed
into the advice.

On 22 December 2010 08:50, Marko Umek <marko.umek@xxxxxxxxxxxxx> wrote:
> So my question is: Using the thisJoinPoint instance already has an 
> impact on the performance (speed or memory usage) even the 
> thisJoinPoint getters won't be called? Does the code weaver add 
> reflecting code fragments to the advice, even the join point is not used?

Yes, it will have an impact.  I presume the decision about whether logging
is on/off is currently made in your advice and by then it is too late - the
thisJoinPoint object will have already been built.
However, there is something simple you can do.  If the pointcut has an
if() clause, that can be a guard that prevents unnecessary creation of the
joinpoint object.  Usually in a logging aspect you will have a global
boolean that configures logging off/on across the system.  If you check that
boolean in your if() pcd then the join point object won't be built if the
if() test fails (and the advice will not be called.  For example:

before(): execution(* *(..)) && if(GlobalLoggingFlagIsTrue);

cheers
Andy

> Hi,
>
> I've read about performance issues on accessing the join point context
(i.e.
> thisJoinPoint.getArgs()). I'm writing a logging facade and sometimes 
> it's necessary to access the argument list or executing context 
> (getThis). Using of the join point context depends if the log level is 
> appropriate. So in production the debugging information won't be used, 
> so accessing the arguments or getThis() is wasting time and memory.
>
>
> Thx
>
> Marko
> --
> View this message in context: 
> http://aspectj.2085585.n4.nabble.com/Is-there-any-performance-issue-us
> ing-thisJoinPoint-tp3160915p3160915.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> 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



*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************



Back to the top