This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Speed up array allocation


Here's that benchmark I mentioned.


public class ArrayAlloc
{
  static int LOOP_COUNT = 5000000;

  public static ArrayAlloc[] bs;

  public static void main(String[] args)
  {
    start();
    for (int i = 0; i < LOOP_COUNT; i++)
    {
      bs = new ArrayAlloc[10];
    }
    stop();
  }
  
  static long startTime;
  
  static void start()
  {
    startTime = System.currentTimeMillis();
  }
  
  static void stop()
  {
    long time = System.currentTimeMillis() - startTime;
    System.out.println(time + "ms");
  }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]