Changeset 12979 for branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Tests/QueryMatchPerformanceTest.cs
- Timestamp:
- 10/02/15 01:08:30 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Tests/QueryMatchPerformanceTest.cs
r12951 r12979 1 1 using System; 2 using System.Diagnostics; 2 3 using System.Linq; 3 4 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 11 12 private const int MaxDepth = 12; 12 13 private const int MaxLength = 50; 13 private const int N = 100000;14 14 private const int N = 50000; 15 private const int Repetitions = 5; 15 16 16 17 [TestMethod] … … 28 29 }; 29 30 var qm = new QueryMatch(comparer) { MatchParents = true }; 30 31 // warmup 31 32 int count = trees.Skip(1).Count(x => qm.Match(x, trees[0])); 32 33 34 var sw = new Stopwatch(); 35 sw.Start(); 36 for (int i = 0; i < Repetitions; ++i) 37 count = trees.Skip(1).Count(x => x.Length >= trees[0].Length && qm.Match(x, trees[0])); 38 sw.Stop(); 39 33 40 Console.WriteLine("Count: " + count); 41 Console.WriteLine("Query matches per second: " + (N - 1) / (sw.ElapsedMilliseconds / 1000.0) * Repetitions); 42 Console.WriteLine("Total time: " + sw.ElapsedMilliseconds / 1000.0 + "s"); 43 44 sw.Restart(); 45 for (int i = 0; i < Repetitions; ++i) 46 count = qm.GetMatchingTrees(trees.Skip(1), trees[0]).Count(); 47 sw.Stop(); 48 49 Console.WriteLine("Count: " + count); 50 Console.WriteLine("Optimized query matches per second: " + (N - 1) / (sw.ElapsedMilliseconds / 1000.0) * Repetitions); 51 Console.WriteLine("Total time: " + sw.ElapsedMilliseconds / 1000.0 + "s"); 34 52 } 35 53 }
Note: See TracChangeset
for help on using the changeset viewer.