[ 
https://issues.apache.org/jira/browse/DELTASPIKE-783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14217816#comment-14217816
 ] 

Gerhard Petracek commented on DELTASPIKE-783:
---------------------------------------------

sure - however, we would need to use the cdi 1.1 api at build-time -> you can 
get other cdi 1.1+ usages in easily (which you have to drop later on).
i just checked it with wf8 - if we >would< get rid of 100 000 of such checks, 
the startup would be ~5ms faster (and even less on faster boxes).
every idea to improve deltaspike is very welcome for sure, but imo the 
potential issues (and at least the initial work to change it) is worse than a 
startup which is 5ms slower (usually project-specific code like creating 
test-data,... is the real bottleneck here).

> Use @WithAnnotations
> --------------------
>
>                 Key: DELTASPIKE-783
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-783
>             Project: DeltaSpike
>          Issue Type: Improvement
>    Affects Versions: 1.1.0
>            Reporter: Jozef Hartinger
>
> Make use of CDI's @WithAnnotations feature.
> Each extension that does something like:
> {code:JAVA}
> <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event) {
>     if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) {
>         return;
>     }
>     // ...
> {code}
> can be extended to:
> {code:JAVA}
> <X> void processAnnotatedType(@Observes @WithAnnotations(Foo.class) 
> ProcessAnnotatedType<X> event) {
>     if (!event.getAnnotatedType().isAnnotationPresent(Foo.class)) {
>         return;
>     }
>     // ...
> {code}
> This can yield performance boost in CDI 1.1+ environment because:
> 1) the observer method will be only called for annotated types that have the 
> annotation, not for all the types in the deployment
> 2) the container may not event need to load the annotated type and its class 
> at all if there are no observers requesting the type and the type does not 
> represent a bean.
> In addition, this works nice in CDI 1.0 environment where the class 
> definition for the annotation is not be found and is ignored.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to