This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Re: Speed up array allocation
- To: java-patches at sources dot redhat dot com
- Subject: Re: Speed up array allocation
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 05 Jan 2001 20:15:57 +1300
- References: <3A556FCB.58FBBAC7@albatross.co.nz>
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");
}
}