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-using-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