Index: /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 361)
+++ /trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 362)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.osm;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -12,4 +13,5 @@
 
 import org.openstreetmap.josm.data.osm.visitor.Visitor;
+import org.openstreetmap.josm.tools.DateParser;
 
 
@@ -88,6 +90,12 @@
 	 * used to check against edit conflicts.
 	 */
-	public Date timestamp = null;
-
+	public String timestamp = null;
+	
+	/**
+	 * The timestamp is only parsed when this is really necessary, and this 
+	 * is the cache for the result.
+	 */
+	public Date parsedTimestamp = null;
+	
 	/**
 	 * If set to true, this object is incomplete, which means only the id
@@ -108,4 +116,20 @@
 		modified = true;
 	}
+	
+	/**
+	 * Returns the timestamp for this object, or the current time if none is set.
+	 * Internally, parses the timestamp from XML into a Date object and caches it
+	 * for possible repeated calls.
+	 */
+	public Date getTimestamp() {
+		if (parsedTimestamp == null) {
+			try {
+				parsedTimestamp = DateParser.parse(timestamp);
+			} catch (ParseException ex) {
+				parsedTimestamp = new Date();
+			}
+		}
+		return parsedTimestamp;
+ 	}
 
 	/**
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java	(revision 361)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeVisitor.java	(revision 362)
@@ -288,6 +288,4 @@
 	private <P extends OsmPrimitive> boolean mergeAfterId(Map<P,P> merged, Collection<P> primitives, P other) {
 		for (P my : primitives) {
-			Date d1 = my.timestamp == null ? new Date(0) : my.timestamp;
-			Date d2 = other.timestamp == null ? new Date(0) : other.timestamp;
 			if (my.realEqual(other, false)) {
 				if (merged != null)
@@ -299,5 +297,5 @@
 				if (merged != null)
 					merged.put(other, my);
-				if (d1.before(d2)) {
+				if (my.getTimestamp().before(other.getTimestamp())) {
 					my.modified = other.modified;
 					my.timestamp = other.timestamp;
@@ -311,5 +309,5 @@
 						merged.put(other, my);
 				} else if (!my.modified && !other.modified) {
-					if (d1.before(d2)) {
+					if (my.getTimestamp().before(other.getTimestamp())) {
 						cloneFromExceptIncomplete(my, other);
 						if (merged != null)
@@ -317,5 +315,5 @@
 					}
 				} else if (other.modified) {
-					if (d1.after(d2)) {
+					if (my.getTimestamp().after(other.getTimestamp())) {
 						conflicts.put(my, other);
 						if (merged != null)
@@ -327,5 +325,5 @@
 					}
 				} else if (my.modified) {
-					if (d2.after(d1)) {
+					if (my.getTimestamp().before(other.getTimestamp())) {
 						conflicts.put(my, other);
 						if (merged != null)
Index: /trunk/src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 361)
+++ /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 362)
@@ -8,6 +8,8 @@
 import java.io.InputStreamReader;
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -150,5 +152,5 @@
 					current = new OsmPrimitiveData();
 					readCommon(atts, current);
-					ways.put((OsmPrimitiveData)current, new LinkedList<Long>());
+					ways.put((OsmPrimitiveData)current, new ArrayList<Long>());
 				} else if (qName.equals("nd")) {
 					Collection<Long> list = ways.get(current);
@@ -224,4 +226,6 @@
 		String time = atts.getValue("timestamp");
 		if (time != null && time.length() != 0) {
+			/* Do not parse the date here since it wastes a HUGE amount of time.
+			 * Moved into OsmPrimitive.
 			try {
 				current.timestamp = DateParser.parse(time);
@@ -230,4 +234,6 @@
 				throw new SAXException(tr("Couldn't read time format \"{0}\".",time));
 			}
+			*/
+			current.timestamp = time;
 		}
 		
@@ -290,4 +296,5 @@
 			adder.visit(w);
 		}
+		
 	}
 
@@ -393,8 +400,10 @@
         	throw new SAXException(e1);
         }
-		if (pleaseWaitDlg != null) {
+
+        if (pleaseWaitDlg != null) {
 			pleaseWaitDlg.progress.setValue(0);
 			pleaseWaitDlg.currentAction.setText(tr("Preparing data..."));
 		}
+
 		for (Node n : osm.nodes.values())
 			osm.adder.visit(n);
