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

Michael McCandless commented on LUCENE-3866:
--------------------------------------------

I ran quick perf test:
{noformat}
                Task    QPS base StdDev base   QPS patchStdDev patch      Pct 
diff
             Respell       92.15        1.40       90.30        2.70   -6% -    
2%
            PKLookup      130.68        4.16      128.24        2.28   -6% -    
3%
              Fuzzy2       41.79        0.40       41.14        1.11   -5% -    
2%
              Fuzzy1      108.97        2.40      107.33        2.87   -6% -    
3%
         AndHighHigh       16.19        0.48       15.97        0.31   -6% -    
3%
              Phrase       12.90        0.32       12.74        0.36   -6% -    
4%
          AndHighMed       64.18        1.81       63.46        1.83   -6% -    
4%
        SloppyPhrase        8.37        0.29        8.29        0.11   -5% -    
3%
            SpanNear        5.51        0.12        5.46        0.18   -6% -    
4%
         TermGroup1M       36.19        0.60       35.89        0.74   -4% -    
2%
        TermBGroup1M       70.64        0.49       70.74        0.57   -1% -    
1%
             Prefix3       61.07        3.58       61.25        1.35   -7% -    
8%
            Wildcard       40.84        2.20       41.00        0.98   -7% -    
8%
                Term      147.32        3.85      149.65        4.87   -4% -    
7%
      TermBGroup1M1P       50.32        1.58       51.29        0.88   -2% -    
7%
              IntNRQ        9.96        1.40       10.18        0.56  -15% -   
25%
          OrHighHigh       10.31        0.74       10.56        0.57   -9% -   
16%
           OrHighMed       12.95        1.01       13.26        0.79  -10% -   
17%
{noformat}

Basically no real change ... good!
                
> Make CompositeReader.getSequentialSubReaders() and the corresponding 
> IndexReaderContext methods return unmodifiable List<R extends IndexReader>
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3866
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3866
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-3866-step1.patch, LUCENE-3866-step2.patch, 
> LUCENE-3866-step2.patch
>
>
> Since Lucene 2.9 we have the method getSequentialSubReader() returning 
> IndexReader[]. Based on hardly-to-debug errors in user's code, Robert and me 
> realized that returning an array from a public API is an anti-pattern. If the 
> array is intended to be modifiable (like byte[] in terms,...), it is fine to 
> use arrays in public APIs, but not, if the array must be protected from 
> modification. As IndexReaders are 100% unmodifiable in trunk code (no 
> deletions,...), the only possibility to corrumpt the reader is by modifying 
> the array returned by getSequentialSubReaders(). We should prevent this.
> The same theoretically applies to FieldCache, too - but the party that is 
> afraid of performance problems is too big to fight against that :(
> For getSequentialSubReaders there is no performance problem at all. The 
> binary search of reader-ids inside BaseCompositeReader can still be done with 
> the internal protected array, but public APIs should expose only a 
> unmodifiable List. The same applies to leaves() and children() in 
> IndexReaderContext. This change to list would also allow to make 
> CompositeReader and CompositeReaderContext Iterable<R extends IndexReader>, 
> so some loops would look nice.

--
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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to