Skip to content

Commit

Permalink
*) Some performance improvements
Browse files Browse the repository at this point in the history
- many classes set to final
- implementation of a session-thread pool
- reusage of the server handler class (normally the httpd object)
  within the session thread
- implementation of a httpc object pool
- introduction of a linebuffer in httpd which can be reused
- reusing the properties table in the httpc
- added to apache libs (commons-collections, commons-pool) which 
  are needed for the object/thread pool implementation

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@26 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
(no author) committed Apr 19, 2005
1 parent d5ff81c commit f39812d
Show file tree
Hide file tree
Showing 27 changed files with 1,318 additions and 717 deletions.
Binary file added lib/commons-collections.jar
Binary file not shown.
Binary file added lib/commons-pool-1.2.jar
Binary file not shown.
27 changes: 15 additions & 12 deletions makerelease.sh
Expand Up @@ -52,9 +52,12 @@ release='yacy_dev_v'$version'_'$datestr
target='RELEASE'
classes='classes'
source='source'
lib='lib'
doc='doc'
data='DATA'
mainclass='yacy.java'
classpath='$classes:$lib'

mkdir $release

# clean up
Expand Down Expand Up @@ -103,18 +106,18 @@ mv -f $source/$mainclass $source/$mainclass.orig
sed `echo 's/<<REPL_DATE>>/'$datestr'/'` $source/$mainclass.orig > $source/$mainclass.sed1
sed `echo 's/<<REPL_VERSION>>/'$version'/'` $source/$mainclass.sed1 > $source/$mainclass
rm $source/$mainclass.sed1
#javac -classpath $classes -sourcepath $source -d $classes -g:none $source/httpd.java
#javac -classpath $classes -sourcepath $source -d $classes -g:none $source/$mainclass
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/tools/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/net/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/htmlFilter/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/server/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/http/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/kelondro/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/data/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/plasma/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/de/anomic/yacy/*.java
javac -classpath $classes -sourcepath $source -d $classes -g $source/$mainclass
#javac -classpath $classpath -sourcepath $source -d $classes -g:none $source/httpd.java
#javac -classpath $classpath -sourcepath $source -d $classes -g:none $source/$mainclass
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/tools/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/net/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/htmlFilter/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/server/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/http/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/kelondro/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/data/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/plasma/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/de/anomic/yacy/*.java
javac -classpath $classpath -sourcepath $source -d $classes -g $source/$mainclass
mv -f $source/$mainclass.orig $source/$mainclass

# compile server pages
Expand Down
17 changes: 9 additions & 8 deletions source/de/anomic/htmlFilter/htmlFilterOutputStream.java
Expand Up @@ -53,7 +53,7 @@
import java.util.*;
import de.anomic.server.*;

public class htmlFilterOutputStream extends OutputStream {
public final class htmlFilterOutputStream extends OutputStream {

public static final byte lb = (byte) '<';
public static final byte rb = (byte) '>';
Expand Down Expand Up @@ -321,14 +321,15 @@ private void write(byte b) throws IOException {
}
} else if (inScript) {
buffer.append(b);
int bufferLength = buffer.length();
if ((b == rb) && (buffer.length() > 14) &&
(buffer.byteAt(buffer.length() - 8) == (byte) '/') &&
(buffer.byteAt(buffer.length() - 7) == (byte) 's') &&
(buffer.byteAt(buffer.length() - 6) == (byte) 'c') &&
(buffer.byteAt(buffer.length() - 5) == (byte) 'r') &&
(buffer.byteAt(buffer.length() - 4) == (byte) 'i') &&
(buffer.byteAt(buffer.length() - 3) == (byte) 'p') &&
(buffer.byteAt(buffer.length() - 2) == (byte) 't')) {
(buffer.byteAt(bufferLength - 8) == (byte) '/') &&
(buffer.byteAt(bufferLength - 7) == (byte) 's') &&
(buffer.byteAt(bufferLength - 6) == (byte) 'c') &&
(buffer.byteAt(bufferLength - 5) == (byte) 'r') &&
(buffer.byteAt(bufferLength - 4) == (byte) 'i') &&
(buffer.byteAt(bufferLength - 3) == (byte) 'p') &&
(buffer.byteAt(bufferLength - 2) == (byte) 't')) {
// script is at end
inScript = false;
if (out != null) out.write(buffer.getBytes());
Expand Down
14 changes: 7 additions & 7 deletions source/de/anomic/http/httpHeader.java
Expand Up @@ -57,9 +57,9 @@ keys are not compared by the equal() method, but are always
import java.text.*;
import de.anomic.server.*;

public class httpHeader extends TreeMap implements Map {
public final class httpHeader extends TreeMap implements Map {

private HashMap reverseMappingCache;
private final HashMap reverseMappingCache;

private static Collator insensitiveCollator = Collator.getInstance(Locale.US);
static {
Expand Down Expand Up @@ -111,16 +111,17 @@ public httpHeader(HashMap reverseMappingCache, Map othermap) {
// we override the put method to make use of the reverseMappingCache
public Object put(Object key, Object value) {
String k = (String) key;
String upperK = k.toUpperCase();
if (reverseMappingCache == null) {
return super.put(k, value);
} else {
if (reverseMappingCache.containsKey(k.toUpperCase())) {
if (reverseMappingCache.containsKey(upperK)) {
// we put in the value using the reverse mapping
return super.put(reverseMappingCache.get(k.toUpperCase()), value);
return super.put(reverseMappingCache.get(upperK), value);
} else {
// we put in without a cached key and store the key afterwards
Object r = super.put(k, value);
reverseMappingCache.put(k.toUpperCase(), k);
reverseMappingCache.put(upperK, k);
return r;
}
}
Expand Down Expand Up @@ -180,9 +181,8 @@ public static Date parseHTTPDate(String s) {
} catch (java.lang.NumberFormatException e) {
//System.out.println("ERROR long version parse: " + e.getMessage() + " at position " + e.getErrorOffset());
serverLog.logError("HTTPC-header", "DATE ERROR (NumberFormat): " + s);
new Date();
return new Date();
}
return new Date();
}

private Date headerDate(String kind) {
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/http/httpTemplate.java
Expand Up @@ -46,7 +46,7 @@
import java.util.*;
import java.io.*;

public class httpTemplate {
final class httpTemplate {

private static final byte hash = (byte)'#';
private static final byte[] hasha = {hash};
Expand Down

0 comments on commit f39812d

Please sign in to comment.