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

Uwe Schindler commented on LUCENE-5640:
---------------------------------------

How about this:
- I wait for your additional benchmark: I changed the code already to be more 
effective, maybe that makes it. It wozuld also be good to one time compare the 
combined case with Java 8 instead Java 7. Maybe there are improvements in Java 
8 not yet in Java 7 regarding MethodHandle. In that case your argument is of 
course correct and it may be to early to change the default packed attribute imp
- If the benchmark shows a neglectible slowdown (I don't accept 1% or 2% or 
like that - if you change the JDK version this 1% is easily reached and is in 
most cases just the happyness of Hotspot), I will change the default attribute 
factory for Token using PackedTokenAttributeImpl to have the explicit ctor call.
- The others like the deprecated Token#TokenAttributeFactory and the mayn 
test-ones can use the dynamic code. In trunk I would like to let the 
non-explicit one in trunk, so I would commit the explicit new 
PackedTokenAttributeImpl() in 4.x. Is this a deal? Trunk will go to Java 8 at 
some time, so we are on the right path.
- MethodHandles instead of Constrcutor instances should really be used for the 
DEFAULT_ATTRIBUTE_FACTORY because there should be a huge improvement (I did 
quick Mircobench: Class#newInstance() slower than Constructor#newInstance 
muuuuch slower than MethodHandle#invokeExact. This is the case, because all the 
access checks and type conversions are done one time and not on every 
instantiation.

> Cleanup Token class
> -------------------
>
>                 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
>             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. In fact, Token 
> should just look like a clone of all AttributeImpl it implements.



--
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