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

Marshall Schor commented on UIMA-5573:
--------------------------------------

I found an approach that looks very promising.  I tried it out, manually 
changing Annotation JCas class, and ran the big growing the CAS test, multiple 
times - it seems to be equally fast as the current approach for getting / 
setting features in a Feature Structure.

It introduces a small indirection, that allows the JCas class to load and 
initialize ahead of the type system commit.  (Of course, you must eventually 
commit a type system before trying to use the JCas class for a type to make new 
instances, get/set features).

This indirection is a new one available in Java 7 and 8, and makes use of a new 
object called a MutableCallSite.  The good news is that the JIT compiler is 
able to compile-out this indirection, which is why this performs so well.

Unfortunately, the change to do this is somewhat extensive:  JCasGen needs to 
change, as does the v3-migration tool, to generate the new format.  All the 
hand-done built-in JCas classes need updating as well.  So it may take a bit of 
time...

> uv3 change JCas feature slot initialization to be more lazy
> -----------------------------------------------------------
>
>                 Key: UIMA-5573
>                 URL: https://issues.apache.org/jira/browse/UIMA-5573
>             Project: UIMA
>          Issue Type: Improvement
>          Components: Core Java Framework
>    Affects Versions: 3.0.0SDK-alpha02
>            Reporter: Marshall Schor
>            Assignee: Marshall Schor
>            Priority: Minor
>             Fix For: 3.0.0SDK-beta
>
>
> The current implementation of JCas classes requires that a type system 
> associated with a JCas class be committed before the JCas class is loaded.  
> This causes some existing code to fail, because they're causing a JCas class 
> to be loaded before the type system is committed (see UIMA-5554).  
> The reason for this design in v3 was to enable the computation of the offsets 
> for accessing features in feature structures to be done once and saved in 
> static final int values, for efficiency. 
> Find a new approach, which is as efficient, but is more lazy - allowing JCas 
> classes to be loaded, and later a corresponding type system commit to be run.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to