performance hacks

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5730 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 61f9dbf0cc
commit ebe5d69d14

@ -84,7 +84,7 @@ public class Gap extends TreeMap<Long, Integer> {
*/
public int dump(File file) throws IOException {
Iterator<Map.Entry<Long, Integer>> i = this.entrySet().iterator();
DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file), 1024 * 1024));
DataOutputStream os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file), 4 * 1024 * 1024));
int c = 0;
Map.Entry<Long, Integer> e;
while (i.hasNext()) {

@ -340,7 +340,7 @@ public class HeapReader {
public entries(final File blobFile, final int keylen) throws IOException {
if (!(blobFile.exists())) throw new IOException("file " + blobFile + " does not exist");
this.is = new DataInputStream(new BufferedInputStream(new FileInputStream(blobFile), 1024*1024));
this.is = new DataInputStream(new BufferedInputStream(new FileInputStream(blobFile), 4*1024*1024));
this.keylen = keylen;
this.blobFile = blobFile;
this.nextEntry = next0();

@ -73,7 +73,7 @@ public final class HeapWriter {
this.heapFile = heapFile;
this.keylength = keylength;
this.index = new LongHandleIndex(keylength, ordering, 10, 100000);
this.os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(heapFile), 1024 * 1024));
this.os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(heapFile), 8 * 1024 * 1024));
//this.doublecheck = new HashSet<String>();
this.seek = 0;
}

@ -98,7 +98,7 @@ public class LongHandleIndex {
// otherwise we could just write the byte[] from the in kelondroRowSet which would make
// everything much faster, but this is not an option here.
Iterator<Row.Entry> i = this.index.rows(true, null);
OutputStream os = new BufferedOutputStream(new FileOutputStream(file), 1024 * 1024);
OutputStream os = new BufferedOutputStream(new FileOutputStream(file), 4 * 1024 * 1024);
int c = 0;
while (i.hasNext()) {
os.write(i.next().bytes());

@ -58,7 +58,7 @@ public class RowCollection implements Iterable<Row.Entry> {
protected byte[] chunkcache;
protected int chunkcount;
protected long lastTimeRead, lastTimeWrote;
protected long lastTimeWrote;
public Row rowdef;
protected int sortBound;
@ -74,7 +74,6 @@ public class RowCollection implements Iterable<Row.Entry> {
this.chunkcache = rc.chunkcache;
this.chunkcount = rc.chunkcount;
this.sortBound = rc.sortBound;
this.lastTimeRead = rc.lastTimeRead;
this.lastTimeWrote = rc.lastTimeWrote;
}
@ -83,7 +82,6 @@ public class RowCollection implements Iterable<Row.Entry> {
this.chunkcache = new byte[objectCount * rowdef.objectsize];
this.chunkcount = 0;
this.sortBound = 0;
this.lastTimeRead = System.currentTimeMillis();
this.lastTimeWrote = System.currentTimeMillis();
}
@ -92,7 +90,6 @@ public class RowCollection implements Iterable<Row.Entry> {
this.chunkcache = cache;
this.chunkcount = objectCount;
this.sortBound = sortBound;
this.lastTimeRead = System.currentTimeMillis();
this.lastTimeWrote = System.currentTimeMillis();
}
@ -106,7 +103,6 @@ public class RowCollection implements Iterable<Row.Entry> {
Log.logWarning("RowCollection", "corrected wrong chunkcount; chunkcount = " + this.chunkcount + ", chunkcachelength = " + chunkcachelength + ", rowdef.objectsize = " + rowdef.objectsize);
this.chunkcount = chunkcachelength / rowdef.objectsize; // patch problem
}
this.lastTimeRead = (exportedCollection.getColLong(exp_last_read) + 10957) * day;
this.lastTimeWrote = (exportedCollection.getColLong(exp_last_wrote) + 10957) * day;
final String sortOrderKey = exportedCollection.getColString(exp_order_type, null);
ByteOrder oldOrder = null;
@ -170,7 +166,7 @@ public class RowCollection implements Iterable<Row.Entry> {
assert (sortBound <= chunkcount) : "sortBound = " + sortBound + ", chunkcount = " + chunkcount;
assert (this.chunkcount <= chunkcache.length / rowdef.objectsize) : "chunkcount = " + this.chunkcount + ", chunkcache.length = " + chunkcache.length + ", rowdef.objectsize = " + rowdef.objectsize;
entry.setCol(exp_chunkcount, this.chunkcount);
entry.setCol(exp_last_read, daysSince2000(this.lastTimeRead));
entry.setCol(exp_last_read, daysSince2000(System.currentTimeMillis()));
entry.setCol(exp_last_wrote, daysSince2000(this.lastTimeWrote));
entry.setCol(exp_order_type, (this.rowdef.objectOrder == null) ? "__".getBytes() :this.rowdef.objectOrder.signature().getBytes());
entry.setCol(exp_order_bound, this.sortBound);
@ -220,10 +216,6 @@ public class RowCollection implements Iterable<Row.Entry> {
chunkcache.length, newChunkcache.length));
chunkcache = newChunkcache;
}
public final long lastRead() {
return lastTimeRead;
}
public final long lastWrote() {
return lastTimeWrote;
@ -236,7 +228,6 @@ public class RowCollection implements Iterable<Row.Entry> {
if ((chunkcache == null) || (rowdef == null)) return null; // case may appear during shutdown
if (index >= chunkcount) return null;
if ((index + 1) * rowdef.objectsize > chunkcache.length) return null; // the whole chunk does not fit into the chunkcache
this.lastTimeRead = System.currentTimeMillis();
final byte[] b = new byte[this.rowdef.width(0)];
System.arraycopy(chunkcache, index * rowdef.objectsize, b, 0, b.length);
return b;
@ -255,7 +246,6 @@ public class RowCollection implements Iterable<Row.Entry> {
if (addr + rowdef.objectsize > chunkcache.length) return null; // the whole chunk does not fit into the chunkcache
entry = rowdef.newEntry(chunkcache, addr, clone);
}
this.lastTimeRead = System.currentTimeMillis();
return entry;
}

Loading…
Cancel
Save