Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-Dev

[jira] [Updated] (LUCENE-4317) Field.java does not reuse its inlined Keyword-TokenStream

 

 

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded


jira at apache

Aug 21, 2012, 2:08 AM

Post #1 of 3 (83 views)
Permalink
[jira] [Updated] (LUCENE-4317) Field.java does not reuse its inlined Keyword-TokenStream

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

Uwe Schindler updated LUCENE-4317:
----------------------------------

Attachment: LUCENE-4317.patch

Patch:
- Streamlines handling of NumericTokenStreanm and a new internal StringTokenStream. Previous code was not easy to read.
- Reuse of both (of course, not accross field instances). This improves the performance of reused Field instances enormous, as creating a new TokenStream for each small String is heavy (2 LinkedHashMaps, addition of attributes,...)

We should maybe think about a solution how to "cache" the instances across several instances (like IndexWriter did in 3.x). I was thinking about a singleton Analyzer...

For now this patch helps a lot.

> Field.java does not reuse its inlined Keyword-TokenStream
> ---------------------------------------------------------
>
> Key: LUCENE-4317
> URL: https://issues.apache.org/jira/browse/LUCENE-4317
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0-BETA
> Reporter: Uwe Schindler
> Assignee: Uwe Schindler
> Fix For: 5.0, 4.0
>
> Attachments: LUCENE-4317.patch
>
>
> Field.java contains a inlined Keyword-TokenStream. Unfortunately this one is recreated all the time, although one reuses the same Field instance. For NumericTokenStream Field.java reuses it, but the Keyword one not.
> We should apply the same logic and lazy init the TokenStream with a setter for the String value and reset(). This would be looking identical to SetNumeric(xx).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe [at] lucene
For additional commands, e-mail: dev-help [at] lucene


jira at apache

Aug 22, 2012, 12:10 PM

Post #2 of 3 (82 views)
Permalink
[jira] [Updated] (LUCENE-4317) Field.java does not reuse its inlined Keyword-TokenStream [In reply to]

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

Uwe Schindler updated LUCENE-4317:
----------------------------------

Attachment: LUCENE-4317-2.patch

Patch. It refactors ReusableStringReader a bit and also adds support for read(), because thats heavy (new char[1] on every call). It removes useless read(char[]) instead as this is just delegation in Reader.java.
I will create a small test to be 100% sure that it's correct and then commit.

> Field.java does not reuse its inlined Keyword-TokenStream
> ---------------------------------------------------------
>
> Key: LUCENE-4317
> URL: https://issues.apache.org/jira/browse/LUCENE-4317
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0-BETA
> Reporter: Uwe Schindler
> Assignee: Uwe Schindler
> Fix For: 5.0, 4.0
>
> Attachments: LUCENE-4317-2.patch, LUCENE-4317.patch
>
>
> Field.java contains a inlined Keyword-TokenStream. Unfortunately this one is recreated all the time, although one reuses the same Field instance. For NumericTokenStream Field.java reuses it, but the Keyword one not.
> We should apply the same logic and lazy init the TokenStream with a setter for the String value and reset(). This would be looking identical to SetNumeric(xx).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe [at] lucene
For additional commands, e-mail: dev-help [at] lucene


jira at apache

Aug 22, 2012, 1:02 PM

Post #3 of 3 (77 views)
Permalink
[jira] [Updated] (LUCENE-4317) Field.java does not reuse its inlined Keyword-TokenStream [In reply to]

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

Uwe Schindler updated LUCENE-4317:
----------------------------------

Attachment: LUCENE-4317-2.patch

Patch with test added. Setting to null before or after close does not matter, as it will never NPE.

I will commit soon!

> Field.java does not reuse its inlined Keyword-TokenStream
> ---------------------------------------------------------
>
> Key: LUCENE-4317
> URL: https://issues.apache.org/jira/browse/LUCENE-4317
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Affects Versions: 4.0-BETA
> Reporter: Uwe Schindler
> Assignee: Uwe Schindler
> Fix For: 5.0, 4.0
>
> Attachments: LUCENE-4317-2.patch, LUCENE-4317-2.patch, LUCENE-4317.patch
>
>
> Field.java contains a inlined Keyword-TokenStream. Unfortunately this one is recreated all the time, although one reuses the same Field instance. For NumericTokenStream Field.java reuses it, but the Keyword one not.
> We should apply the same logic and lazy init the TokenStream with a setter for the String value and reset(). This would be looking identical to SetNumeric(xx).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe [at] lucene
For additional commands, e-mail: dev-help [at] lucene

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.