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

Robert Muir commented on MAHOUT-706:
------------------------------------

right, Analyzer is thread-safe: the reused streams are stored in a threadlocal: 
http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/Analyzer.java

when you call reusableTokenStream(), it grabs the per-thread saved one and 
calls reset() instead of creating a new one... creating a new one (all the 
tokenstreams and attributes) is very heavy.


> reuse lucene tokenstreams
> -------------------------
>
>                 Key: MAHOUT-706
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-706
>             Project: Mahout
>          Issue Type: Improvement
>            Reporter: Robert Muir
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 0.6
>
>         Attachments: MAHOUT-706.patch
>
>
> Currently, mahout uses Lucene's non-reusable analysis API.
> This means that per-"document", a lot of objects are recreated (e.g. every 
> TokenStream in the analysis chain, every Attribute).
> This can create a lot of unnecessary overhead, particularly if "documents" 
> are short.
> It looks like an easy win to use the reusable API (reusableTokenStream) 
> instead.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to