Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
performance hack: replaced generic row.getColBytes() call with row.getPrimaryKeyBytes() where the column is 0
orbiter1110d16af9fe
diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.javaindex 3766aef94..6576144d7 100755--- a/source/de/anomic/crawler/ZURL.java+++ b/source/de/anomic/crawler/ZURL.java@@ -253,7 +253,7 @@ public class ZURL implements Iterable<ZURL.Entry> {this.workcount = (int) entry.getColLong(3);this.anycause = entry.getColString(4, "UTF-8");this.bentry = new Request(Request.rowdef.newEntry(entry.getColBytes(5, false)));- assert (Base64Order.enhancedCoder.equal(entry.getColBytes(0, false), bentry.url().hash()));+ assert (Base64Order.enhancedCoder.equal(entry.getPrimaryKeyBytes(), bentry.url().hash()));this.stored = true;return;}diff --git a/source/de/anomic/crawler/retrieval/Request.java b/source/de/anomic/crawler/retrieval/Request.javaindex cfb26d77a..1bded5807 100755--- a/source/de/anomic/crawler/retrieval/Request.java+++ b/source/de/anomic/crawler/retrieval/Request.java@@ -140,7 +140,7 @@ public class Request extends WorkflowJob {if (urlstring == null) throw new IOException ("url string is null");this.initiator = entry.getColBytes(1, true);this.initiator = (initiator == null) ? null : ((initiator.length == 0) ? null : initiator);- this.url = new DigestURI(urlstring, entry.getColBytes(0, true));+ this.url = new DigestURI(urlstring, entry.getPrimaryKeyBytes());this.refhash = (entry.empty(3)) ? null : entry.getColBytes(3, true);this.name = (entry.empty(4)) ? "" : entry.getColString(4, "UTF-8").trim();this.appdate = entry.getColLong(5);diff --git a/source/net/yacy/dbtest.java b/source/net/yacy/dbtest.javaindex 03318f6fb..792713c2a 100644--- a/source/net/yacy/dbtest.java+++ b/source/net/yacy/dbtest.java@@ -166,7 +166,7 @@ public class dbtest {try {Row.Entry entryBytes = getTable_test().get(entry.getKey());if (entryBytes != null) {- final STEntry dbEntry = new STEntry(entryBytes.getColBytes(0, true), entryBytes.getColBytes(1, true));+ final STEntry dbEntry = new STEntry(entryBytes.getPrimaryKeyBytes(), entryBytes.getColBytes(1, true));if (!dbEntry.isValid()) {System.out.println("INVALID table_test: " + dbEntry);} /* else {@@ -177,7 +177,7 @@ public class dbtest {if (getTable_reference() != null) {entryBytes = getTable_reference().get(entry.getKey());if (entryBytes != null) {- final STEntry dbEntry = new STEntry(entryBytes.getColBytes(0, true), entryBytes.getColBytes(1, true));+ final STEntry dbEntry = new STEntry(entryBytes.getPrimaryKeyBytes(), entryBytes.getColBytes(1, true));if (!dbEntry.isValid()) {System.out.println("INVALID table_reference: " + dbEntry);} /* else {diff --git a/source/net/yacy/kelondro/index/HandleSet.java b/source/net/yacy/kelondro/index/HandleSet.javaindex 5e75d967b..54eafc230 100644--- a/source/net/yacy/kelondro/index/HandleSet.java+++ b/source/net/yacy/kelondro/index/HandleSet.java@@ -184,7 +184,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable {Row.Entry indexentry;indexentry = index.removeOne();if (indexentry == null) return null;- return indexentry.getColBytes(0, true);+ return indexentry.getPrimaryKeyBytes();}/**@@ -198,7 +198,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable {Row.Entry indexentry;indexentry = index.get(this.size() - 1 - idx, true);if (indexentry == null) return null;- return indexentry.getColBytes(0, true);+ return indexentry.getPrimaryKeyBytes();}public final synchronized boolean isEmpty() {diff --git a/source/net/yacy/kelondro/index/Row.java b/source/net/yacy/kelondro/index/Row.javaindex d8ed5fa23..f8bcb8ee1 100644--- a/source/net/yacy/kelondro/index/Row.java+++ b/source/net/yacy/kelondro/index/Row.java@@ -160,7 +160,7 @@ public final class Row {public final Entry newEntry(final Entry oldrow, final int fromColumn) {if (oldrow == null) return null;assert (oldrow.getColBytes(0, false)[0] != 0);- assert (this.objectOrder.wellformed(oldrow.getColBytes(0, false), 0, this.primaryKeyLength));+ assert (this.objectOrder.wellformed(oldrow.getPrimaryKeyBytes(), 0, this.primaryKeyLength));return new Entry(oldrow, fromColumn, false);}diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.javaindex ce358f378..57bedf165 100644--- a/source/net/yacy/kelondro/index/RowCollection.java+++ b/source/net/yacy/kelondro/index/RowCollection.java@@ -1008,9 +1008,9 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {if (chunkcount != this.sortBound) return false;/*for (int i = 0; i < chunkcount - 1; i++) {- //System.out.println("*" + new String(get(i).getColBytes(0)));+ //System.out.println("*" + new String(get(i).getPrimaryKeyBytes()));if (compare(i, i + 1) > 0) {- System.out.println("?" + new String(get(i + 1, false).getColBytes(0)));+ System.out.println("?" + new String(get(i + 1, false).getPrimaryKeyBytes()));return false;}}@@ -1133,7 +1133,7 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {System.out.println("create c : " + (t1 - t0) + " nanoseconds, " + d(testsize, (t1 - t0)) + " entries/nanoseconds");final RowCollection d = new RowCollection(r, testsize);for (int i = 0; i < testsize; i++) {- d.add(c.get(i, false).getColBytes(0, false));+ d.add(c.get(i, false).getPrimaryKeyBytes());}final long t2 = System.nanoTime();System.out.println("copy c -> d: " + (t2 - t1) + " nanoseconds, " + d(testsize, (t2 - t1)) + " entries/nanoseconds");diff --git a/source/net/yacy/kelondro/index/RowSet.java b/source/net/yacy/kelondro/index/RowSet.javaindex 58a119745..9fced6c88 100644--- a/source/net/yacy/kelondro/index/RowSet.java+++ b/source/net/yacy/kelondro/index/RowSet.java@@ -544,7 +544,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>Row.Entry entry;while (ii.hasNext()) {entry = ii.next();- s = new String(entry.getColBytes(0, true)).trim();+ s = new String(entry.getPrimaryKeyBytes()).trim();System.out.print(s + ", ");if (s.equals("drei")) ii.remove();}diff --git a/source/net/yacy/kelondro/table/SQLTable.java b/source/net/yacy/kelondro/table/SQLTable.javaindex f31626953..bdd2a2be8 100644--- a/source/net/yacy/kelondro/table/SQLTable.java+++ b/source/net/yacy/kelondro/table/SQLTable.java@@ -196,7 +196,7 @@ public class SQLTable implements Index, Iterable<Row.Entry> {public Row.Entry replace(final Row.Entry row) throws IOException {try {- final Row.Entry oldEntry = remove(row.getColBytes(0, false));+ final Row.Entry oldEntry = remove(row.getPrimaryKeyBytes());final String sqlQuery = "INSERT INTO test (" +"hash, " +"value) " +diff --git a/source/net/yacy/kelondro/table/SplitTable.java b/source/net/yacy/kelondro/table/SplitTable.javaindex 67e5bbf06..fa1259e0e 100644--- a/source/net/yacy/kelondro/table/SplitTable.java+++ b/source/net/yacy/kelondro/table/SplitTable.java@@ -344,7 +344,7 @@ public class SplitTable implements Index, Iterable<Row.Entry> {public Row.Entry replace(final Row.Entry row) throws IOException, RowSpaceExceededException {assert row.objectsize() <= this.rowdef.objectsize;- Index keeper = keeperOf(row.getColBytes(0, true));+ Index keeper = keeperOf(row.getPrimaryKeyBytes());if (keeper != null) return keeper.replace(row);synchronized (this.tables) {assert this.current == null || this.tables.get(this.current) != null : "this.current = " + this.current;@@ -363,8 +363,9 @@ public class SplitTable implements Index, Iterable<Row.Entry> {*/public boolean put(final Row.Entry row) throws IOException, RowSpaceExceededException {assert row.objectsize() <= this.rowdef.objectsize;+ byte[] key = row.getPrimaryKeyBytes();synchronized (this.tables) {- Index keeper = keeperOf(row.getColBytes(0, true));+ Index keeper = keeperOf(key);if (keeper != null) return keeper.put(row);assert this.current == null || this.tables.get(this.current) != null : "this.current = " + this.current;keeper = (this.current == null) ? newTable() : checkTable(this.tables.get(this.current));diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.javaindex 64eb38f37..ddaf09781 100644--- a/source/net/yacy/kelondro/util/FileUtils.java+++ b/source/net/yacy/kelondro/util/FileUtils.java@@ -487,11 +487,11 @@ public final class FileUtils {final Iterator<Row.Entry> i = set.iterator();String key;if (i.hasNext()) {- key = new String(i.next().getColBytes(0, false));+ key = new String(i.next().getPrimaryKeyBytes());os.write(key.getBytes("UTF-8"));}while (i.hasNext()) {- key = new String(i.next().getColBytes(0, false));+ key = new String(i.next().getPrimaryKeyBytes());if (sep != null) os.write(sep.getBytes("UTF-8"));os.write(key.getBytes("UTF-8"));}