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

Uwe Schindler edited comment on LUCENE-5640 at 5/5/14 10:04 AM:
----------------------------------------------------------------

bq. Doesn't it also impact things like save/restoreState and cloning?

No. Save/restore state does not add/remove attributes. cloneAttributes() 
creates a deep clone of the internal maps, so it just copies what is already 
there. AttributeFactory is not used.

This code only affects addAttribute - so constructing new TokenStreams, if the 
attribute is not already there. And this is only done on construction. This 
patch largely improves adding non-common attributes like KeywordAttribute or 
PayloadAttribute. The PackedAttributeImpl is the same as before, we can still 
talk about the explicit {{new}}, although I disagree here.

This is like other discussions: Code duplication is not good just to win 1% of 
performance in a micro-benchmark. This is what you always telling Mike, too.


was (Author: thetaphi):
bq. Doesn't it also impact things like save/restoreState and cloning?

No.

> 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