title: Why parsing a String into Date in Java is slow? Can we accelerate it?
body: <p>I am reading a text file containing dates, and I want to parse the Strings representing the dates into Date objects in java. What I notice is the operation is slow. Why? is there any way to accelerate it?
  My file looks like:</p>
  
  <pre><code>2012-05-02 12:08:06:950, secondColumn, thirdColumn
  2012-05-02 12:08:07:530, secondColumn, thirdColumn
  2012-05-02 12:08:08:610, secondColumn, thirdColumn
  </code></pre>
  
  <p>I am reading the file line by line, then I am getting the date <code>String</code> from each line, then I am parsing it into a <code>Date</code> object using a <code>SimpleDateFormat</code> as follow:</p>
  
  <pre><code>DataInputStream in = new DataInputStream(myFileInputStream);
  BufferedReader  br = new BufferedReader(new InputStreamReader(in));
  String strLine;
  
  SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  while ((strLine = br.readLine()) != null)
  {
      ....Do things....
      Date myDateTime = (Date)formatter.parse(myDateString);
      ...Do things....
  }
  </code></pre>