mirror of https://github.com/apache/lucene.git
LUCENE-5798: Optimize MultiDocsEnum reuse
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1607049 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c103dbf62
commit
04ef241474
|
@ -113,6 +113,8 @@ Optimizations
|
|||
* LUCENE-5782: OrdinalMap now sorts enums before being built in order to
|
||||
improve compression. (Adrien Grand)
|
||||
|
||||
* LUCENE-5798: Optimize MultiDocsEnum reuse. (Robert Muir)
|
||||
|
||||
======================= Lucene 4.9.0 =======================
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Arrays;
|
|||
public final class MultiDocsAndPositionsEnum extends DocsAndPositionsEnum {
|
||||
private final MultiTermsEnum parent;
|
||||
final DocsAndPositionsEnum[] subDocsAndPositionsEnum;
|
||||
private EnumWithSlice[] subs;
|
||||
private final EnumWithSlice[] subs;
|
||||
int numSubs;
|
||||
int upto;
|
||||
DocsAndPositionsEnum current;
|
||||
|
@ -42,6 +42,10 @@ public final class MultiDocsAndPositionsEnum extends DocsAndPositionsEnum {
|
|||
public MultiDocsAndPositionsEnum(MultiTermsEnum parent, int subReaderCount) {
|
||||
this.parent = parent;
|
||||
subDocsAndPositionsEnum = new DocsAndPositionsEnum[subReaderCount];
|
||||
this.subs = new EnumWithSlice[subReaderCount];
|
||||
for (int i = 0; i < subs.length; i++) {
|
||||
subs[i] = new EnumWithSlice();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns {@code true} if this instance can be reused by
|
||||
|
@ -53,9 +57,7 @@ public final class MultiDocsAndPositionsEnum extends DocsAndPositionsEnum {
|
|||
/** Rre-use and reset this instance on the provided slices. */
|
||||
public MultiDocsAndPositionsEnum reset(final EnumWithSlice[] subs, final int numSubs) {
|
||||
this.numSubs = numSubs;
|
||||
this.subs = new EnumWithSlice[subs.length];
|
||||
for(int i=0;i<subs.length;i++) {
|
||||
this.subs[i] = new EnumWithSlice();
|
||||
for(int i=0;i<numSubs;i++) {
|
||||
this.subs[i].docsAndPositionsEnum = subs[i].docsAndPositionsEnum;
|
||||
this.subs[i].slice = subs[i].slice;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Arrays;
|
|||
public final class MultiDocsEnum extends DocsEnum {
|
||||
private final MultiTermsEnum parent;
|
||||
final DocsEnum[] subDocsEnum;
|
||||
private EnumWithSlice[] subs;
|
||||
private final EnumWithSlice[] subs;
|
||||
int numSubs;
|
||||
int upto;
|
||||
DocsEnum current;
|
||||
|
@ -44,14 +44,16 @@ public final class MultiDocsEnum extends DocsEnum {
|
|||
public MultiDocsEnum(MultiTermsEnum parent, int subReaderCount) {
|
||||
this.parent = parent;
|
||||
subDocsEnum = new DocsEnum[subReaderCount];
|
||||
this.subs = new EnumWithSlice[subReaderCount];
|
||||
for (int i = 0; i < subs.length; i++) {
|
||||
subs[i] = new EnumWithSlice();
|
||||
}
|
||||
}
|
||||
|
||||
MultiDocsEnum reset(final EnumWithSlice[] subs, final int numSubs) {
|
||||
this.numSubs = numSubs;
|
||||
|
||||
this.subs = new EnumWithSlice[subs.length];
|
||||
for(int i=0;i<subs.length;i++) {
|
||||
this.subs[i] = new EnumWithSlice();
|
||||
for(int i=0;i<numSubs;i++) {
|
||||
this.subs[i].docsEnum = subs[i].docsEnum;
|
||||
this.subs[i].slice = subs[i].slice;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue