replaced RowSetArray in ObjectIndexCache with RowSet to reduce complexity in MergeIterator. This complexity caused too much computing overhead when the RowSetArray had become very large.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6810 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 0d04ab1422
commit ff6cf24b80

@ -38,21 +38,21 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>
private final Row rowdef;
private RowSet index0;
private RowSetArray index1;
private RowSet index1;
private final Row.EntryComparator entryComparator;
private final int spread;
//private final int spread;
public ObjectIndexCache(final Row rowdef, final int expectedspace) {
this.rowdef = rowdef;
this.entryComparator = new Row.EntryComparator(rowdef.objectOrder);
this.spread = Math.max(10, expectedspace / 3000);
//this.spread = Math.max(10, expectedspace / 3000);
reset();
}
public ObjectIndexCache(final Row rowdef, final int expectedspace, final int initialspace) throws RowSpaceExceededException {
this.rowdef = rowdef;
this.entryComparator = new Row.EntryComparator(rowdef.objectOrder);
this.spread = Math.max(10, expectedspace / 3000);
//this.spread = Math.max(10, expectedspace / 3000);
reset(initialspace);
}
@ -82,7 +82,7 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>
index0.sort();
index0.uniq();
index0.trim(false);
index1 = new RowSetArray(rowdef, spread);
index1 = new RowSet(rowdef); //new RowSetArray(rowdef, spread);
}
}
@ -243,7 +243,7 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>
// finish initialization phase
index0.sort();
index0.uniq();
index1 = new RowSetArray(rowdef, spread);
index1 = new RowSet(rowdef); //new RowSetArray(rowdef, spread);
return index0.keys(up, firstKey);
}
assert (index1 != null);
@ -272,7 +272,7 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>
// finish initialization phase
index0.sort();
index0.uniq();
index1 = new RowSetArray(rowdef, spread);
index1 = new RowSet(rowdef); //new RowSetArray(rowdef, spread);
return index0.rows(up, firstKey);
}
assert (index1 != null);
@ -306,7 +306,7 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>
// finish initialization phase
index0.sort();
index0.uniq();
index1 = new RowSetArray(rowdef, spread);
index1 = new RowSet(rowdef); //new RowSetArray(rowdef, spread);
return index0.rows();
}
assert (index1 != null);

@ -68,14 +68,14 @@ public class MergeIterator<E> implements CloneableIterator<E> {
private void nexta() {
try {
if ((a != null) && (a.hasNext())) na = a.next(); else na = null;
if (a != null && a.hasNext()) na = a.next(); else na = null;
} catch (final ConcurrentModificationException e) {
na = null;
}
}
private void nextb() {
try {
if ((b != null) && (b.hasNext())) nb = b.next(); else nb = null;
if (b != null && b.hasNext()) nb = b.next(); else nb = null;
} catch (final ConcurrentModificationException e) {
nb = null;
}
@ -118,7 +118,7 @@ public class MergeIterator<E> implements CloneableIterator<E> {
nexta();
nextb();
return s;
} else if (((up) && (c < 0)) || ((!(up)) && (c > 0))) {
} else if ((up && c < 0) || (!up && c > 0)) {
s = na;
nexta();
return s;

Loading…
Cancel
Save