Example #1
0
        public void DynamicSerieTests()
        {
            DummyLambda(a => a);
            Dummy(3);

            const int max = 100000;
            var start = new DateTime(1000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var rowsA = new List<ISingleDataRow<int>>();
            var rowsB = new List<ISingleDataRow<int>>();

            for (var i = 0; i < max; i++)
            {
                rowsA.Add(new SingleDataRow<int>(start + TimeSpan.FromMinutes(i), i));
                rowsB.Add(new SingleDataRow<int>(start + TimeSpan.FromMinutes(i), i*2));
            }

            var serieA = new QuerySerie<int>(rowsA, start, start + TimeSpan.FromMinutes(max)) {Name = "A", Key = "A"};
            var serieB = new QuerySerie<int>(rowsB, start, start + TimeSpan.FromMinutes(max)) {Name = "B", Key = "B"};
            var table = new QueryTable<int>();
            table.AddSerie(serieA);
            table.AddSerie(serieB);

            //var sw = Stopwatch.StartNew();
            //var result = table.Do(i => i.GroupByHours(1, t => t.Mean())).ZipToNew<int>("SumTable", t => t.A + t.B);
            //sw.Stop();

            var sw2 = Stopwatch.StartNew();
            var result2 = table.Transform(i => i.GroupByMinutes(1, t => t.First()))
                .ZipToNew("DiffTable", t => t.A - t.B);
            sw2.Stop();
        }
Example #2
0
        public void DynamicSerieTests()
        {
            DummyLambda(a => a);
            Dummy(3);

            const int max   = 100000;
            var       start = new DateTime(1000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            var       rowsA = new List <ISingleDataRow <int> >();
            var       rowsB = new List <ISingleDataRow <int> >();


            for (var i = 0; i < max; i++)
            {
                rowsA.Add(new SingleDataRow <int>(start + TimeSpan.FromMinutes(i), i));
                rowsB.Add(new SingleDataRow <int>(start + TimeSpan.FromMinutes(i), i * 2));
            }

            var serieA = new QuerySerie <int>(rowsA, start, start + TimeSpan.FromMinutes(max))
            {
                Name = "A", Key = "A"
            };
            var serieB = new QuerySerie <int>(rowsB, start, start + TimeSpan.FromMinutes(max))
            {
                Name = "B", Key = "B"
            };
            var table = new QueryTable <int>();

            table.AddSerie(serieA);
            table.AddSerie(serieB);

            //var sw = Stopwatch.StartNew();
            //var result = table.Do(i => i.GroupByHours(1, t => t.Mean())).ZipToNew<int>("SumTable", t => t.A + t.B);
            //sw.Stop();

            var sw2     = Stopwatch.StartNew();
            var result2 = table.Transform(i => i.GroupByMinutes(1, t => t.First()))
                          .ZipToNew("DiffTable", t => t.A - t.B);

            sw2.Stop();
        }