Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/22/14 17:18:07 (10 years ago)
Author:
bburlacu
Message:

#2215: Further improved performance of the BottomUpSimilarityCalculator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BottomUpTreeDistance/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SimilarityCalculators/BottomUpSimilarityCalculator.cs

    r11486 r11487  
    7979
    8080      // visit nodes in order of decreasing height to ensure correct mapping
    81       foreach (var v in n1.IterateNodesPrefix().OrderByDescending(x => compactedGraph[x].Depth)) {
     81      var nodes1 = n1.IterateNodesPrefix().ToList();
     82      var nodes2 = n2.IterateNodesPrefix().ToList();
     83      foreach (var v in nodes1) {
    8284        if (forwardMap.ContainsKey(v))
    8385          continue;
    8486        var kv = compactedGraph[v];
    8587        ISymbolicExpressionTreeNode w = null;
    86         foreach (var t in n2.IterateNodesPrefix()) {
     88        foreach (var t in nodes2) {
    8789          if (reverseMap.ContainsKey(t) || compactedGraph[t] != kv)
    8890            continue;
     
    123125
    124126      var nodes = n1.IterateNodesPostfix().Concat(n2.IterateNodesPostfix()); // the disjoint union F
    125       var list = new List<GraphNode>(); // preallocate size to avoid list resizing as it has a performance hit
     127      var list = new List<GraphNode>();
    126128      var queue = new Queue<ISymbolicExpressionTreeNode>();
    127129
Note: See TracChangeset for help on using the changeset viewer.