Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356612 - Performance problem with @annotation(x) on field access
Summary: Performance problem with @annotation(x) on field access
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 1.6.12   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-02 11:08 EDT by Missing name CLA
Modified: 2011-09-02 18:34 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name CLA 2011-09-02 11:08:46 EDT
Build Identifier: 

Some time ago there was a bug report about slow performance with
@annotation on method level:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=296484

I want to report a similar issue with the @annotation on field access level.

Using something like the following advice which captures the use of a
@Bind-annotation on field set access results in poor performance:

       Object around(Object host, Bind bind, Object newGuest)
       : set(@Bind !java.util.Collection+ *.*)
                       && this(host) && args(newGuest) && @annotation(bind)
       {
               // ...
               return proceed(host, bind, newGuest);
       }

A workaround similar to the one descirbed in the bug reports performs
much better:

       Object around(Object host, Object newGuest)
       : set(@Bind !java.util.Collection+ *.*)
               && this(host) && args(newGuest)
       {
               Bind bind = ((FieldSignature)
thisJoinPointStaticPart.getSignature()).getField().getAnnotation(Bind.class);
               // ...
               return proceed(host, newGuest);
       }

Reproducible: Always
Comment 1 Andrew Clement CLA 2011-09-02 18:34:39 EDT
fixes are in.  Similar to 296484.  I also optimized it to try and share the cached field where possible (when @annotation is used for a kinded shadow, like field-get/field-set) - that should prevent a proliferation of fields (previously it was using one field per shadow).