LUCENE-6885: StandardDirectoryReader (initialCapacity) tweaks

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1712939 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-11-06 11:16:21 +00:00
parent 23dd31d768
commit 4ef2d43d58
2 changed files with 5 additions and 2 deletions

View File

@ -183,6 +183,9 @@ Optimizations
* LUCENE-6878: Speed up TopDocs.merge. (Daniel Jelinski via Adrien Grand)
* LUCENE-6885: StandardDirectoryReader (initialCapacity) tweaks
(Christine Poerschke)
Bug Fixes
* LUCENE-6817: ComplexPhraseQueryParser.ComplexPhraseQuery does not display

View File

@ -80,7 +80,7 @@ final class StandardDirectoryReader extends DirectoryReader {
// no need to process segments in reverse order
final int numSegments = infos.size();
List<SegmentReader> readers = new ArrayList<>();
final List<SegmentReader> readers = new ArrayList<>(numSegments);
final Directory dir = writer.getDirectory();
final SegmentInfos segmentInfos = infos.clone();
@ -136,7 +136,7 @@ final class StandardDirectoryReader extends DirectoryReader {
// we put the old SegmentReaders in a map, that allows us
// to lookup a reader using its segment name
final Map<String,Integer> segmentReaders = new HashMap<>();
final Map<String,Integer> segmentReaders = (oldReaders == null ? Collections.emptyMap() : new HashMap<>(oldReaders.size()));
if (oldReaders != null) {
// create a Map SegmentName->SegmentReader