[ 
https://issues.apache.org/jira/browse/LUCENE-5640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-5640:
----------------------------------

    Description: 
We should remove code duplication in the Token class:
- copy constructors
- reinit() shit
- non-default clone()

This is too bugy. Most of the methods can be simply removed.

This issue will also factor out the basic attributes to a separate 
implementation class (without the Token extra stuff). Token then just extends 
this class (in the tokenattributes package) and adds the additional stuff not 
needed for an Attribute. Token itsself will get deprecated.

Also part of the slowdown in the parent issue is caused by ineffective 
DefaultAttributeFactory, which uses reflection to instantiate new attributes. 
As we are on Java 7 now, we can use MethodHandle to do this. MethodHandle does 
access checks only once on creating the factory or when the attribute is seen 
first. Later invocations are done without any result type conversions and 
parameter conversions as a statically linked constructor call. This greatly 
improves performance with Java 8, Java 7 is approx as fast, unless its 
completely static.

  was:
We should remove code duplication in the Token class:
- copy constructors
- reinit() shit
- non-default clone()

This is too bugy. Most of the methods can be simply removed. In fact, Token 
should just look like a clone of all AttributeImpl it implements.

       Assignee: Uwe Schindler
        Summary: Cleanup & deprecate Token class / Improve default 
AttributeFactory to no longer use reflection  (was: Cleanup Token class)

> Cleanup & deprecate Token class / Improve default AttributeFactory to no 
> longer use reflection
> ----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-5640
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5640
>             Project: Lucene - Core
>          Issue Type: Sub-task
>          Components: modules/analysis
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.9, 5.0
>
>         Attachments: LUCENE-5640.patch, LUCENE-5640.patch, LUCENE-5640.patch, 
> LUCENE-5640.patch, LUCENE-5640.patch
>
>
> We should remove code duplication in the Token class:
> - copy constructors
> - reinit() shit
> - non-default clone()
> This is too bugy. Most of the methods can be simply removed.
> This issue will also factor out the basic attributes to a separate 
> implementation class (without the Token extra stuff). Token then just extends 
> this class (in the tokenattributes package) and adds the additional stuff not 
> needed for an Attribute. Token itsself will get deprecated.
> Also part of the slowdown in the parent issue is caused by ineffective 
> DefaultAttributeFactory, which uses reflection to instantiate new attributes. 
> As we are on Java 7 now, we can use MethodHandle to do this. MethodHandle 
> does access checks only once on creating the factory or when the attribute is 
> seen first. Later invocations are done without any result type conversions 
> and parameter conversions as a statically linked constructor call. This 
> greatly improves performance with Java 8, Java 7 is approx as fast, unless 
> its completely static.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to