[
https://issues.apache.org/jira/browse/LUCENE-5640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13989304#comment-13989304
]
Uwe Schindler edited comment on LUCENE-5640 at 5/5/14 6:12 AM:
---------------------------------------------------------------
Hi Robert, I think the small difference is explained:
In trunk we currently use Token class and the TokenAttributeFactory is creating
it with {{new Token()}} after the {{isAssignableFrom()}} so there is no
overhead at all. The latest patch is using a more generic factory with
invokeExact. FYI, {{isAssignableFrom()}} is iintrinsic.
If you compare the reflection-based patch (not trunk) with this one, you should
see a large improvement; if you compare trunk with this, maybe a small
degradion (which is what you see) because of extra invokeExact overhead. This
code is now similar to Java 8's closures that use the "::" operator.
In any case, as we reuse TokenStreams this was just a hard check of what
happens if you don't reuse, so the latest patch is a huge improvement.
was (Author: thetaphi):
Hi Robert, I think the small difference is explained:
In trunk we currently use Token class and the TokenAttributeFactory is creating
it with new Token() so there is no overhead at all. The latest patch is using a
more generic factory with invokeExact.
If you compare the reflection-based patch (not trunk) with this one, you should
see a large improvement; if you compare trunk with this, maybe a small
degradion (which is what you see) because of extra invokeExact overhead. This
code is now similar to Java 8's closures that use the "::" operator.
In any case, as we reuse TokenStreams this was just a hard check of what
happens if you don't reuse, so the latest patch is a huge improvement.
> 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
>
>
> 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]