Order doesn't matter - pointcuts are rewritten to an optimal form by the compiler/weaver with 'cheapest' tests first.
Andy On 22 December 2010 22:54, <jeanlouis.pastu...@orange-ftgroup.com> wrote: > > 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-boun...@eclipse.org > [mailto:aspectj-users-boun...@eclipse.org] De la part de Andy Clement > Envoyé : mercredi 22 décembre 2010 18:43 > À : aspectj-users@eclipse.org > 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.u...@open-doors.ch> 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@eclipse.org >> https://dev.eclipse.org/mailman/listinfo/aspectj-users >> > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > 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. > ******************************** > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > _______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users