[aspectc-user] Setting return value in advice very expensive

Olaf Spinczyk os at aspectc.org
Fri Sep 2 09:45:23 CEST 2011


We haven't made any observations of significant performance degradation 
caused by result value modifications.

It is important to have code optimization enabled (e.g. compile with 
-O2). Otherwise the around advice and all the small joinpoint API 
functions won't be inlined, which is essential from the performance 
point of view.

Furthermore, have you checked whether the call to 
VMThread_get_safe_global caused the problem here? One thing you could 
try in order to find the root of the problem is to implement (a) empty 
around advice and (b) around advice which only contains "*tjp->result() 
= *tjp->result();". After that we will better know where the performance 
problem really comes from.



On 09/01/2011 08:21 PM, Stefan Marr wrote:
> Hi:
> We have here a simple around advice which replaces basically the original function and needs to return a value.
> In our benchmark that leads to an overall performance impact of 10% which is quite a bit.
> It is not exactly a tight loop but on the critical path of every interpreter action.
> The advice reads as follows:
> 	advice execution("_VMFrame* Interpreter_get_frame()") : around() {
> 		pVMFrame frame = (pVMFrame)VMThread_get_safe_global(tsg_frame);
> 		*tjp->result() = frame;
> 	}
> Are there any tips or hacks that could lead to less performance overhead?
> Thanks
> Stefan

More information about the aspectc-user mailing list