I'm building a test harness in java, and trying to compare the performance and latency of two parsers. The parses munge data coming off of a live, single feed. I have no control over the feed, nor do I have a "simulated feed" for mocking data, so to compare apples to apples, I'd like to run my parses as concurrently as possible. I'm new to java and threading, so am not sure if this is the best approach. My idea was to spin 2 threads:
SomeFeed feed = new SomeFeed();
Thread thread1 = new Thread () {
public void run () {
parser1.parseFeed(feed);
}
};
Thread thread2 = new Thread () {
public void run () {
parse2.parseFeed(feed);
}
};
thread1.start();
thread2.start();
Will threads run this way operate roughly synchronously? Or is there a better approach?
Thanks