Can this Google Hurdles code be made to run any faster? Anyone can play Google Hurdles today. Here is my score: 1.1 second. Is there are way of improving this score and running faster than a second?

http://www.google.com/doodles/hurdles-2012

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;


public class RunOlim {

private volatile static boolean run=true;

public static void main(String[] args) {
    Robot robot = null;


    Thread th = new Thread(new Runnable(){

        @Override
        public void run() {
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }finally {
                run=false;
            }

        }

    });
    th.start();

    try {
        robot = new Robot();
    } catch (AWTException e) {

        e.printStackTrace();
    }
    while(run){
        robot.keyPress(KeyEvent.VK_RIGHT);
        robot.keyRelease(KeyEvent.VK_RIGHT);

        robot.keyPress(KeyEvent.VK_LEFT);
        robot.keyRelease(KeyEvent.VK_LEFT);
    }
}

}
There are some general notes about the code, not really performance improvements (however, I have not tested their performance). I guess the real bottleneck could be in the browser/OS/hardware which can't handle more key events.

Anyway, these do not need any other thread:


final long endTime = System.nanoTime() 
    + TimeUnit.NANOSECONDS.convert(10, TimeUnit.SECONDS);
while (endTime &gt; System.nanoTime()) {
    robot.keyPress(KeyEvent.VK_RIGHT);
    robot.keyRelease(KeyEvent.VK_RIGHT);

    robot.keyPress(KeyEvent.VK_LEFT);
    robot.keyRelease(KeyEvent.VK_LEFT);
}

final long endTime = System.nanoTime() 
    + TimeUnit.NANOSECONDS.convert(10, TimeUnit.SECONDS);
while (endTime &gt; System.nanoTime()) {
    for (int i = 0; i &lt; 100; i++) {
        robot.keyPress(KeyEvent.VK_RIGHT);
        robot.keyRelease(KeyEvent.VK_RIGHT);

        robot.keyPress(KeyEvent.VK_LEFT);
        robot.keyRelease(KeyEvent.VK_LEFT);
    }
}



Maybe these were your first tries too.

Here is a 3rd one with a ScheduledExecutorService:

public static void main(final String[] args) throws AWTException {

    final ScheduledExecutorService scheduledExecutorService = 
        Executors.newScheduledThreadPool(1);
    final Runnable stopCommand = new Runnable() {
        @Override
        public void run() {
            run = false;
        }
    };
    scheduledExecutorService.schedule(stopCommand, 10, TimeUnit.SECONDS);

    final Robot robot = new Robot();

    while (run) {
        robot.keyPress(KeyEvent.VK_RIGHT);
        robot.keyRelease(KeyEvent.VK_RIGHT);

        robot.keyPress(KeyEvent.VK_LEFT);
        robot.keyRelease(KeyEvent.VK_LEFT);
    }
    scheduledExecutorService.shutdown();
}


A final note from Clean Code, page 25: 


  Classes and objects should have noun or noun phrase names like Customer, WikiPage,
  Account, and AddressParser. [...] A class name should not be a verb.


I'd name it HurdleRunner, for example.