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

Michael Busch commented on LUCENE-937:
--------------------------------------

> While we're looking at this, I noticed three other uses of LinkedList 
> that can be changed to ArrayList: 

Well, an ArrayList is not always faster than a LinkedList, is it? 
A LinkedList should be faster for insertions and removals in the middle 
of the list compared to an ArrayList. So I think we have to understand 
how the lists are used in the different spots before we replace them.

To this patch: I actually chose LinkedList here intentionally because
random-access to the list is not needed here. We only iterate over the
list and I expected the performance to be comparable to the ArrayList.
But inconsequently I used the get() method instead of a list iterator,
which is for sure slower compared to the ArrayList. I wonder how the 
LinkedList would perform if we changed this class to use an iterator?

Thanks Mark your efforts here!

> Make CachingTokenFilter faster
> ------------------------------
>
>                 Key: LUCENE-937
>                 URL: https://issues.apache.org/jira/browse/LUCENE-937
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: CachingTokenFilter.patch
>
>
> The wrong data structure was used for the CachingTokenFilter. It should be an 
> ArrayList rather than a LinkedList. There is a noticeable difference in speed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to