[aspectc-user] aspect efficiency

Daniel Lohmann daniel.lohmann at informatik.uni-erlangen.de
Mon Aug 8 12:00:03 CEST 2005


Ji Jamal,

We are currently working on a micro-benchmark suite that should anwser 
exactly this questions. The results will be made available on 
acpectc.org quite soon. Some general results are, however:

1) Simple before() and after() advice is actually inlined by the 
compiler and leads to no overhead regarding CPU cycles or stack usage.

2) around() is not very efficient in the current implementation, as it 
uses internally the action object for the implementation of 
tjp->proceed(), which results in a function-pointer call that can not be 
inlined. The action object furthermore occupies some stack space.
Olaf is currently implementing a more efficient code generation pattern 
for around() that does not depend on the action object. With this new 
implementation, around() will hopefully be as efficient as 
before()/after().

3) The overhead of any code advice type is mainly determined by the 
amount of joinpoint context accessed by the advice code (e.g. 
tjp->that()). Information such as the pointers returned by that(), 
target(), arg() are stored in the joinpoint object. They require some 
stack space and some cycles for intialisation. The actual call to 
functions such as tjp->that(), however, are inlined, therefore it should 
not matter if you call tem once or several times.
Moreover, ac++ optimizes the generated code by providing only those 
information in the joinpoint object that is actually requested by the 
advice body. If, for instance, tjp->that() is not called, it does not 
lead to stack space and initialization overhead.

4) All of the above highly depend on the inlining capabilities of the 
backend compiler. In our g++ measurements we got dramatic differences 
between using O0, O3 and Os optimizations. Especially using O0, which 
makes the compiler to do not inline anything, results in higher runtime 
and stack costs due to many additional function calls.


You might also take a look into the generated code. It looks a bit, 
well, not so nice in the beginning, but you quickly get used to it.

Hope that helps


Daniel



Jamal Siadat wrote:

>Hi,
>I was just wndering how efficient is the code produced by aspectc++. I
>mean are the advices all inlined? would the extra level of indirection
>used by tjp->that()->... effect the performance of a given software ( I
>mean even if its in milliseconds) ? How much inderection/overhead is
>actually produced for every advice? or tjp->that? if any ( in terms of
>other function calls so if we add 4 or 5 other methods for every piece of
>advice and if we dont inline them then it might degragade the performance
>somewhat?)
>I'm just wondering if I should expect any performace degregation if use
>ac++ in a given system.
>
>Thanks,
>
>P.S: if there are extra levels of indirection is there any work being done
>to reduce them? or is this the nature of AOP and one should expect it?
>
>_______________________________________________
>aspectc-user mailing list
>aspectc-user at aspectc.org
>http://www.aspectc.org/mailman/listinfo/aspectc-user
>  
>




More information about the aspectc-user mailing list