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

Robert Muir commented on LUCENE-7419:
-------------------------------------

That's not the issue as I see it.

To me, the problem is that we do getAttribute per-stream here (rather than once 
in a ctor, like everywhere else). We should not be doing that.

As far as the Packed impl, i did it the way i did to keep it simple and make it 
clear what its doing. If we were to call super.end(), which then would call 
close(), setting positionIncrement to 1, then we were to set it back to 0, i 
mean, that is totally unclear. I can't imagine why we would do it in that way, 
its not like we are paying a tax for lines of code. Even if we were, this would 
be worth it for the extra lines, because its way simpler not to do stuff like 
that!

> performance bug in tokenstream.end()
> ------------------------------------
>
>                 Key: LUCENE-7419
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7419
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>            Priority: Blocker
>             Fix For: master (7.0), 6.2.0
>
>         Attachments: LUCENE-7419.patch
>
>
> TokenStream.end() calls getAttribute(), which is pretty costly to do 
> per-stream.
> It does its current hack, because in the ctor of TokenStream is "too early".
> Instead, we can just add a variant of clear(), called end() to AttributeImpl. 
> For most attributes it defers to clear, but for PosIncAtt it can handle the 
> special case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to