final char[] chars = page.toCharArray();
//warm up parser
for(int i=0;i<10;i++)
{
PageParser parser = new HTMLPageParser();
//FastPageParser parser = new FastPageParser();
parser.parse(chars);
}
//now go crazy
final int threadCount = 5;
Thread[] threads = new Thread[threadCount];
final List[] lists = new ArrayList[threadCount];
final int passes = 50;
for(int i=0;i<threads.length;i++)
{
final int index = i;
lists[index] = new ArrayList(passes);
threads[index] = new Thread(new Runnable()
{
public void run()
{
for(int j=0;j<passes;j++)
{
PageParser parser = new HTMLPageParser();
//PageParser parser = new FastPageParser();
try
{
lists[index].add(parser.parse(chars));
}
catch(IOException e)
{
e.printStackTrace();
}