• Bug
  • Status: New
  • 2 Major
  • Resolution:
  • Byte Code Transform
  • interfaces
  • Reporter: amiller
  • February 22, 2008
  • 0
  • Watchers: 0
  • December 16, 2011

Description

Forum: http://forums.terracotta.org/forums/posts/list/818.page

I tested with code below using java/dso-java and saw differences as well.

import java.util.HashMap; import java.util.Map;

public class IteratorTest { public static void main(String[] args) { int num = 10000000; String val = “”; Map<Integer, String> map = new HashMap<Integer, String>();

for ( int i =0 ; i < num; i ++ )
{
  map.put(i, val);
}

long begin = System.currentTimeMillis();

for ( Integer s : map.keySet() )
{
}

long end = System.currentTimeMillis();
System.out.println("Time: " + (end-begin));   \}  \}

Comments

Alex Miller 2008-02-22

The program above actually uses 10x the number of entries as the forum. I saw about 2x slowdown with 1M, but with 10M (above) I see:

$ java -Xms512m -Xmx512m -cp bin IteratorTest Time: 941

$ dso-java.sh -Xms512m -Xmx512m -cp bin IteratorTest Time: 22829

So, about 20x slowdown. Note nothing is being clustered here, just using the instrumented version of HashMap on an unclustered map. We’re certainly doing checks as to whether $__tc_MANAGED is null and stuff like that during iteration. Seems like more overhead than I would expect though.