示例#1
0
 private void button3_Click(object sender, EventArgs e)
 {
     using (var client = new NWindServiceClient(ConfigName))
     {
         Stopwatch watch = Stopwatch.StartNew();
         var       data  = client.LoadFoo();
         watch.Stop();
         nwindSource.DataSource = data;
         Text = "Loaded Vanilla WCF via " + ConfigName + " (" + watch.ElapsedMilliseconds + "ms)";
     }
 }
示例#2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string config = Convert.ToString(e.Argument);

            using (var client = new NWindServiceClient(config))
            {
                OrderSet set = client.LoadFoo(), copy;

                int count = cheekyCount;
                copy = set;
                string    key      = "Vanilla WCF via " + config;
                Stopwatch fooWatch = Stopwatch.StartNew();
                for (int i = 0; i < count; i++)
                {
                    copy = client.RoundTripFoo(copy);
                    if (i % 10 == 0)
                    {
                        backgroundWorker1.ReportProgress((i * 100) / count, key);
                    }
                }
                fooWatch.Stop();
                copy = set;
                key  = "aqlaserializer via " + config;
                Stopwatch barWatch = Stopwatch.StartNew();
                for (int i = 0; i < count; i++)
                {
                    copy = client.RoundTripBar(copy);
                    if (i % 10 == 0)
                    {
                        backgroundWorker1.ReportProgress((i * 100) / count, key);
                    }
                }
                barWatch.Stop();

                decimal pc = (barWatch.ElapsedMilliseconds * 100.0M) / fooWatch.ElapsedMilliseconds;

                e.Result = string.Format("x{2} via {3} - Vanilla WCF: {0:###,##0}ms, protobuf-net: {1:###,##0}ms ({4:##.#}%)",
                                         fooWatch.ElapsedMilliseconds, barWatch.ElapsedMilliseconds, count, config, pc);
            }
        }
示例#3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string config = Convert.ToString(e.Argument);
            using (var client = new NWindServiceClient(config))
            {
                OrderSet set = client.LoadFoo(), copy;

                int count = cheekyCount;
                copy = set;
                string key = "Vanilla WCF via " + config;
                Stopwatch fooWatch = Stopwatch.StartNew();
                for (int i = 0; i < count; i++)
                {
                    copy = client.RoundTripFoo(copy);
                    if (i % 10 == 0)
                    {
                        backgroundWorker1.ReportProgress((i * 100) / count, key);
                    }
                }
                fooWatch.Stop();
                copy = set;
                key = "protobuf-net via " + config;
                Stopwatch barWatch = Stopwatch.StartNew();
                for (int i = 0; i < count; i++)
                {
                    copy = client.RoundTripBar(copy);
                    if (i % 10 == 0)
                    {
                        backgroundWorker1.ReportProgress((i * 100) / count, key);
                    }
                }
                barWatch.Stop();

                decimal pc = (barWatch.ElapsedMilliseconds * 100.0M) / fooWatch.ElapsedMilliseconds;

                e.Result = string.Format("x{2} via {3} - Vanilla WCF: {0:###,##0}ms, protobuf-net: {1:###,##0}ms ({4:##.#}%)",
                    fooWatch.ElapsedMilliseconds, barWatch.ElapsedMilliseconds, count, config, pc);
            }
        }
示例#4
0
 private void button3_Click(object sender, EventArgs e)
 {
     
     using (var client = new NWindServiceClient(ConfigName))
     {
         Stopwatch watch = Stopwatch.StartNew();
         var data = client.LoadFoo();
         watch.Stop();
         nwindSource.DataSource = data;
         Text = "Loaded Vanilla WCF via " + ConfigName + " (" + watch.ElapsedMilliseconds + "ms)";
     }
 }