Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] LTW vs Compile Time weaving and AspectJ

Hi Andy,

Thank you for this very useful technical information.
You've just clarified the debate within the team (i.e. between LTW and Compile Time).

Thanks again,

Sonny

2008/9/18 Andy Clement <andrew.clement@xxxxxxxxx>
Hi Sonny,

Usually we always try to inline around advice, for performance reasons.  Inlining is the default mechanism to try and use during compile time weaving, but the user may choose to override that with -XnoInline and switch to a closure model.   However, we can only inline around advice if the aspect containing that around advice has already been woven - the advice may be affected by other aspects, and before we extract the advice body instructions from the around and insert them somewhere else, we need to know they aren't going to change again.

In compile time weaving AspectJ controls everything and operates a compilation/weaving pipeline, and the first things through the pipeline are the aspects.  So inlining is not usually restricted by what I said in the first paragraph since when most types get woven, their advising aspect has already been woven.  Same story for binary weaving.

In a load time weaving environment we don't have complete control and are at the mercy of class loading.  If you load type X and we notice it needs weaving by aspect Y, then inlining probably won't happen for X because Y hasn't been woven yet.  After X, the next thing to be woven will be Y, and then after that inlining should occur.

before/after are always handled in the same way by calling the advice from the advised join point.

I would typically recommend compile time weaving or binary weaving unless you particularly need the flexibility of load time weaving.

Andy.


2008/9/18 Sonny <scrisini@xxxxxxxxx>
Hi,

We are heavily into incorporating aspectJ in our cash order management system.
AspectJ will be used in all aspect, sorry about the pun, system type services that we may not want to be included within the business components.
Example of which are performance counter collections of method executions etc.

What I would like to know is the detail of how the "Around" is weaved into the target code. From what I can see when LTW is used a "proxy" based pattern is used by AspectJ whereby the aspectJ class defined by the aspect developer is executed by by AspectJ, we then need to invoke "joinpoint.proceed" to then invoked the original method.
From that I could say that the use of "before" or "after" since it seems that before or after is directly weaved into the the target class, i.e. inlined, as opposed to the method used by Around.

Now the question is, is the same method used above for "Around" is also used when Compile Time weaving, or binary weaving for that matter?

I guess what i'm getting to is a little bit of technical detail of the implementation differences between "around" and "after/before" from the AspectJ compiler/weaver is concern, and in general which one would be more performant, if latency is of utmost importance.

Thank you

--
Sonny


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



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




--
Sonny


Back to the top