title: Java Performance Testing
body: <p>I want to do some timing tests on a Java application. This is what I am currently doing:</p>
  
  <pre><code>long startTime = System.currentTimeMillis();
  doSomething();
  long finishTime = System.currentTimeMillis();
  System.out.println("That took: " + (finishTime - startTime) + " ms");
  </code></pre>
  
  <p>Is there anything "wrong" with performance testing like this?  What is a better way?</p>
  
  <p><strong>Duplicate</strong>: <a href="https://stackoverflow.com/questions/410437/is-stopwatch-benchmarking-acceptable">Is stopwatch benchmarking acceptable?</a></p>