Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
performance hacks
orbiterebe5d69d1475
diff --git a/source/de/anomic/kelondro/blob/Gap.java b/source/de/anomic/kelondro/blob/Gap.javaindex a9fa489ac..aae05f045 100644--- a/source/de/anomic/kelondro/blob/Gap.java+++ b/source/de/anomic/kelondro/blob/Gap.java@@ -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()) {diff --git a/source/de/anomic/kelondro/blob/HeapReader.java b/source/de/anomic/kelondro/blob/HeapReader.javaindex a16688610..d3f054d4b 100644--- a/source/de/anomic/kelondro/blob/HeapReader.java+++ b/source/de/anomic/kelondro/blob/HeapReader.java@@ -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();diff --git a/source/de/anomic/kelondro/blob/HeapWriter.java b/source/de/anomic/kelondro/blob/HeapWriter.javaindex 531cbad42..1f3f11607 100644--- a/source/de/anomic/kelondro/blob/HeapWriter.java+++ b/source/de/anomic/kelondro/blob/HeapWriter.java@@ -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;}diff --git a/source/de/anomic/kelondro/index/LongHandleIndex.java b/source/de/anomic/kelondro/index/LongHandleIndex.javaindex e29de8256..a494dbb6d 100644--- a/source/de/anomic/kelondro/index/LongHandleIndex.java+++ b/source/de/anomic/kelondro/index/LongHandleIndex.java@@ -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());diff --git a/source/de/anomic/kelondro/index/RowCollection.java b/source/de/anomic/kelondro/index/RowCollection.javaindex d513dae2e..61214c9f0 100644--- a/source/de/anomic/kelondro/index/RowCollection.java+++ b/source/de/anomic/kelondro/index/RowCollection.java@@ -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 shutdownif (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 chunkcacheentry = rowdef.newEntry(chunkcache, addr, clone);}- this.lastTimeRead = System.currentTimeMillis();return entry;}