// Compare base and diff file lists and produce a sorted list of method // deltas by file. Delta is computed diffBytes - baseBytes so positive // numbers are regressions. (lower is better) // // Todo: handle metrics where "higher is better" public static IEnumerable <FileDelta> Comparator(IEnumerable <FileInfo> baseInfo, IEnumerable <FileInfo> diffInfo, Config config) { MethodInfoComparer methodInfoComparer = new MethodInfoComparer(); return(baseInfo.Join(diffInfo, b => b.path, d => d.path, (b, d) => { var jointList = b.methodList.Join(d.methodList, x => x.name, y => y.name, (x, y) => new MethodDelta { name = x.name, baseMetrics = new MetricCollection(x.Metrics), diffMetrics = new MetricCollection(y.Metrics), baseOffsets = x.functionOffsets, diffOffsets = y.functionOffsets }) .OrderByDescending(r => r.deltaMetrics.GetMetric(config.Metric).Value); FileDelta f = new FileDelta { basePath = b.path, diffPath = d.path, baseMetrics = jointList.Sum(x => x.baseMetrics), diffMetrics = jointList.Sum(x => x.diffMetrics), deltaMetrics = jointList.Sum(x => x.deltaMetrics), methodsInBoth = jointList.Count(), methodsOnlyInBase = b.methodList.Except(d.methodList, methodInfoComparer), methodsOnlyInDiff = d.methodList.Except(b.methodList, methodInfoComparer), methodDeltaList = jointList.Where(x => x.deltaMetrics.GetMetric(config.Metric).Value != 0) }; if (config.Reconcile) { f.Reconcile(); } return f; }).ToList()); }
// Compare base and diff file lists and produce a sorted list of method // deltas by file. Delta is computed diffBytes - baseBytes so positive // numbers are regressions. (lower is better) public static IEnumerable <FileDelta> Comparator(IEnumerable <FileInfo> baseInfo, IEnumerable <FileInfo> diffInfo, Config config) { MethodInfoComparer methodInfoComparer = new MethodInfoComparer(); return(baseInfo.Join(diffInfo, b => b.path, d => d.path, (b, d) => { var jointList = b.methodList.Join(d.methodList, x => x.name, y => y.name, (x, y) => new MethodDelta { name = x.name, baseBytes = x.totalBytes, diffBytes = y.totalBytes, baseOffsets = x.functionOffsets, diffOffsets = y.functionOffsets }) .OrderByDescending(r => r.deltaBytes); FileDelta f = new FileDelta { path = b.path, baseBytes = jointList.Sum(x => x.baseBytes), diffBytes = jointList.Sum(x => x.diffBytes), deltaBytes = jointList.Sum(x => x.deltaBytes), methodsOnlyInBase = b.methodList.Except(d.methodList, methodInfoComparer), methodsOnlyInDiff = d.methodList.Except(b.methodList, methodInfoComparer), methodDeltaList = jointList.Where(x => x.deltaBytes != 0) }; if (config.Reconcile) { f.Reconcile(); } return f; })); }