Skip to content

Commit

Permalink
some small changes in HandleMap Testing
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6042 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 10, 2009
1 parent b21e914 commit 1c54ae4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions source/de/anomic/kelondro/index/HandleMap.java
Expand Up @@ -373,18 +373,20 @@ public HandleMap call() throws IOException {

public static void main(String[] args) {
int count = (args.length == 0) ? 1000000 : Integer.parseInt(args[0]);
System.out.println("Starting test with " + count + " objects, minimum memory: " + (count * 16) + " bytes; " + MemoryControl.available() + " available");
System.out.println("Starting test with " + count + " objects");
System.out.println("expected memory: " + (count * 16) + " bytes");
System.out.println("available memory: " + MemoryControl.available());
Random r = new Random(0);
long start = System.currentTimeMillis();

System.gc(); // for resource measurement
long a = MemoryControl.available();
HandleMap idx = new HandleMap(12, Base64Order.enhancedCoder, 8, 0, 150000);
HandleMap idx = new HandleMap(12, Base64Order.enhancedCoder, 4, 0, 150000);
for (int i = 0; i < count; i++) {
idx.inc(FlatWordPartitionScheme.positionToHash(r.nextInt(count)));
}
long timek = ((long) count) * 1000L / (System.currentTimeMillis() - start);
System.out.println("Result LongHandleIndex: " + timek + " inc per second " + count + " loops.");
System.out.println("Result HandleMap: " + timek + " inc per second");
System.gc();
long memk = a - MemoryControl.available();
System.out.println("Used Memory: " + memk + " bytes");
Expand All @@ -404,13 +406,13 @@ public static void main(String[] args) {
if (d == null) hm.put(hash, 1); else hm.put(hash, d + 1);
}
long timej = ((long) count) * 1000L / (System.currentTimeMillis() - start);
System.out.println("Result HashMap: " +timej + " inc per second; " + count + " loops.");
System.out.println("Result TreeMap: " + timej + " inc per second");
System.gc();
long memj = a - MemoryControl.available();
System.out.println("Used Memory: " + memj + " bytes");
System.out.println("x " + hm.get(FlatWordPartitionScheme.positionToHash(0)));
System.out.println("Geschwindigkeitsfaktor j/k: " + (timej / timek));
System.out.println("Speicherplatzfaktor j/k: " + (memj / memk));
System.out.println("Geschwindigkeitsfaktor j/k: " + ((float) (10 * timej / timek) / 10.0) + " - je kleiner desto besser fuer kelondro");
System.out.println("Speicherplatzfaktor j/k: " + ((float) (10 * memj / memk) / 10.0) + " - je groesser desto besser fuer kelondro");
System.exit(0);
}

Expand Down

0 comments on commit 1c54ae4

Please sign in to comment.