#24 SingletonAnnotationSet

Core (26)
Julien Nioche

I just found a change I'd made on my local copy of GATE ages ago. I just tested it against the build number 2820 and it seems to work fine.

I've created a class SingletonAnnotationSet which - as its name indicates - exposes a single AS as an AnnotationSet and is immutable.

The original motivation was that I noticed that SinglePhaseTransducer (used by Jape) creates an awful lot of temporary ASets which most of the time contain a single annotation. With a normal AS this triggers the creation of a lot of internal fields (maps etc...) which are absolutely not needed in this case. All these objects have to be garbage collected later, which also takes some time.

I've modified the SinglePhaseTransducer so that it uses SingletonAnnotationSets which seems to make ANNIE a bit faster. I've used the java system parameter -Xloggc which dumps statistics about the GC and found that the patched version spends substantially less time GCing (30 secs vs 35 secs).

I agree that this is probably not the most amazing gain of performance that one could think of but that is a small step in the right direction nevertheless. The impact of this patch should also be more important on machines with little RAM.


  • Julien Nioche
    Julien Nioche

    source code for SingletonAnnotationSet + patch for SinglePhaseTransducer

  • Julien Nioche
    Julien Nioche

    Logged In: YES
    Originator: YES

    as you corrected yourselves - it exposes a single ANNOTATION as an AnnotationSet

    • assigned_to: nobody --> valyt
    • status: open --> closed-accepted
  • Patch accepted and applied.

    It was not possible to apply the exact patch as submitted because the JAPE code has changed.

    The semantics of the patch were preserved though.

    Thanks Julien!