Author: toad
Date: 2006-11-09 19:09:40 +0000 (Thu, 09 Nov 2006)
New Revision: 10844
Modified:
trunk/freenet/src/freenet/support/HTMLEncoder.java
Log:
Minor optimisations to creation phase.
Modified: trunk/freenet/src/freenet/support/HTMLEncoder.java
===================================================================
--- trunk/freenet/src/freenet/support/HTMLEncoder.java 2006-11-09 19:06:24 UTC
(rev 10843)
+++ trunk/freenet/src/freenet/support/HTMLEncoder.java 2006-11-09 19:09:40 UTC
(rev 10844)
@@ -297,11 +297,15 @@
int[] keys = new int[map.size()];
int keyIndex = 0;
+ int max = 0;
for(Iterator it = map.keySet().iterator();it.hasNext();
keyIndex++){
- keys[keyIndex] = (int)
((Character)it.next()).charValue();
+ int val = (int)
((Character)it.next()).charValue();
+ keys[keyIndex] = val;
+ if(max > val) max = val;
}
-
- int[] collisionTable = new int[Character.MAX_VALUE];
//using integers instead of booleans (no cleanup)
+
+ modulo = map.size();
+ int[] collisionTable = new int[max+1]; //using integers
instead of booleans (no cleanup)
boolean ok=false;
while (!ok) {
++modulo; //try a higher modulo