Index: /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.BottomUpTreeDistance.sln
===================================================================
--- /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.BottomUpTreeDistance.sln	(revision 11214)
+++ /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.BottomUpTreeDistance.sln	(revision 11215)
@@ -5,4 +5,9 @@
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj", "{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{296A2ED3-637A-4E1E-8C06-170651BF1F04}"
+	ProjectSection(SolutionItems) = preProject
+		Performance1.psess = Performance1.psess
+	EndProjectSection
 EndProject
 Global
@@ -32,3 +37,6 @@
 		HideSolutionNode = FALSE
 	EndGlobalSection
+	GlobalSection(Performance) = preSolution
+		HasPerformanceSessions = true
+	EndGlobalSection
 EndGlobal
Index: /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs
===================================================================
--- /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs	(revision 11214)
+++ /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimilarityCalculator.cs	(revision 11215)
@@ -39,5 +39,5 @@
     private const string MatchConstantValuesParameterName = "MatchConstantValues";
 
-    private ISymbolicExpressionTreeDistanceCalculator distanceCalculator;
+    private readonly ISymbolicExpressionTreeDistanceCalculator distanceCalculator;
 
     public IScopeTreeLookupParameter<ISymbolicExpressionTree> SymbolicExpressionTreeParameter {
Index: /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpTreeDistanceCalculator.cs
===================================================================
--- /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpTreeDistanceCalculator.cs	(revision 11214)
+++ /branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/TreeDistance/BottomUpTreeDistanceCalculator.cs	(revision 11215)
@@ -26,5 +26,4 @@
 using System.Linq;
 using System.Text;
-using System.Text.RegularExpressions;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -94,10 +93,8 @@
     private static Dictionary<ISymbolicExpressionTreeNode, IVertex> Compact(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2) {
       var nodesToVertices = new Dictionary<ISymbolicExpressionTreeNode, IVertex>(); // K
-      var disjointUnion = new DisjointUnion(t1, t2); // F
       var labelsToVertices = new Dictionary<string, IVertex>(); // L
       var childrenCount = new Dictionary<ISymbolicExpressionTreeNode, int>(); // Children
       var vertices = new List<IVertex>(); // G
-
-      var nodes = disjointUnion.Nodes.ToList();
+      var nodes = t1.IterateNodesPostfix().Concat(t2.IterateNodesPostfix()); // the disjoint union F
 
       // for all leaf labels l in F
@@ -125,8 +122,9 @@
         } else {
           bool found = false;
+          var height = Height(v);
           // for all nodes w in G in reverse order
           for (int i = vertices.Count - 1; i >= 0; --i) {
             var w = vertices[i];
-            if (Height(v) != Height(w) || v.SubtreeCount != w.OutDegree || label != w.Label)
+            if (height != Height(w) || v.SubtreeCount != w.OutDegree || label != w.Label)
               continue;
 
@@ -182,5 +180,4 @@
     }
 
-
     private static string Label(ISymbolicExpressionTreeNode n) {
       return n.ToString();
@@ -195,19 +192,5 @@
     }
 
-    private class DisjointUnion : Tuple<ISymbolicExpressionTree, ISymbolicExpressionTree> {
-      public DisjointUnion(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2)
-        : base(t1, t2) {
-      }
-
-      public IEnumerable<ISymbolicExpressionTreeNode> Nodes {
-        get { return Item1.Root.IterateNodesPostfix().Concat(Item2.Root.IterateNodesPostfix()); }
-      }
-    }
-
-    public static string RemoveFirstLines(string text, int linesCount) {
-      var lines = Regex.Split(text, "\r\n|\r|\n").Skip(linesCount);
-      return string.Join(Environment.NewLine, lines.ToArray());
-    }
-
+    // this is here for debugging purposes only
     // draw the mapping between t1 and t2 as a tikz picture
     private static string FormatMapping(ISymbolicExpressionTree t1, ISymbolicExpressionTree t2, Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> map) {
