Beispiel #1
0
        private void JoinResults()
        {
            if (allResults1 == null || allResults2 == null)
            {
                return;
            }

            var param = new CheckboxParameters(checkIgnoreCategory, checkIgnorePrefix, checkIgnorePostfix, category1, category2, extension1, extension2, sharedDirectory1, sharedDirectory2);
            var join  = InnerJoinOrderedResults(allResults1, allResults2, param, uiService);

            Array.Sort <CompareBenchmarksViewModel>(join, new VMComparer());
            CompareItems = allResults = join;
        }
Beispiel #2
0
        private static CompareBenchmarksViewModel[] InnerJoinOrderedResults(BenchmarkResult[] r1, BenchmarkResult[] r2, CheckboxParameters param, IUIService uiService)
        {
            int n1   = r1.Length;
            int n2   = r2.Length;
            var join = new CompareBenchmarksViewModel[Math.Min(n1, n2)];

            if (!param.IsCategoryChecked && param.Category1 != param.Category2)
            {
                return(new CompareBenchmarksViewModel[0]);
            }
            if (!param.IsPrefixChecked && param.Dir1 != param.Dir2)
            {
                return(new CompareBenchmarksViewModel[0]);
            }
            int i = 0;

            for (int i1 = 0, i2 = 0; i1 < n1 && i2 < n2;)
            {
                string filename1 = r1[i1].BenchmarkFileName;
                string filename2 = r2[i2].BenchmarkFileName;
                if (!param.IsCategoryChecked)
                {
                    filename1 = param.Category1 + "/" + filename1;
                    filename2 = param.Category2 + "/" + filename2;
                }
                if (param.IsPostfixChecked)
                {
                    filename1 = filename1.Substring(0, filename1.Length - param.Ext1.Length);
                    filename2 = filename2.Substring(0, filename2.Length - param.Ext2.Length);
                }
                int cmp = string.Compare(filename1, filename2);
                if (cmp == 0)
                {
                    join[i++] = new CompareBenchmarksViewModel(filename1,
                                                               new BenchmarkResultViewModel(r1[i1], uiService),
                                                               new BenchmarkResultViewModel(r2[i2], uiService),
                                                               uiService);
                    i1++; i2++;
                }
                else if (cmp < 0) // ~ r1 < r2
                {
                    i1++;
                }
                else // ~ r1 > r2
                {
                    i2++;
                }
            }
            var join2 = new CompareBenchmarksViewModel[i];

            for (; --i >= 0;)
            {
                join2[i] = join[i];
            }
            return(join2);
        }
Beispiel #3
0
        private static CompareBenchmarksViewModel[] InnerJoinOrderedResults(BenchmarkResult[] r1, BenchmarkResult[] r2, CheckboxParameters param, IUIService uiService)
        {
            int n1   = r1.Length;
            int n2   = r2.Length;
            var join = new CompareBenchmarksViewModel[Math.Min(n1, n2)];
            int i    = 0;

            for (int i1 = 0, i2 = 0; i1 < n1 && i2 < n2;)
            {
                string filename1 = MakeDatapointName(
                    param.IsPrefixChecked, param.IsCategoryChecked, param.IsPostfixChecked,
                    param.Container1, param.Category1, r1[i1].BenchmarkFileName);
                string filename2 = MakeDatapointName(
                    param.IsPrefixChecked, param.IsCategoryChecked, param.IsPostfixChecked,
                    param.Container2, param.Category2, r2[i2].BenchmarkFileName);

                int cmp = string.Compare(filename1, filename2);
                if (cmp == 0)
                {
                    join[i++] = new CompareBenchmarksViewModel(filename1,
                                                               new BenchmarkResultViewModel(r1[i1], uiService),
                                                               new BenchmarkResultViewModel(r2[i2], uiService),
                                                               uiService);
                    i1++; i2++;
                }
                else if (cmp < 0) // ~ r1 < r2
                {
                    i1++;
                }
                else // ~ r1 > r2
                {
                    i2++;
                }
            }
            var join2 = new CompareBenchmarksViewModel[i];

            for (; --i >= 0;)
            {
                join2[i] = join[i];
            }
            return(join2);
        }