Пример #1
0
        public void run2()
        {
            using (
                var session = TheCouch.CreateSession("cruiseme", new Uri("http://localhost:5984"))///cruiseme_01/_design/ports/_view/by_id?include_docs=true
                )
            {
                var stopWatch = new Stopwatch();

                stopWatch.Start();

                var ports =
                    session.Design("ports").ViewDocs <Destination>("by_id", new ViewQuery()
                {
                    Limit = 100
                }).Documents;

                stopWatch.Stop();

                Console.WriteLine("Total time taken: {0}ms to fetch {1} ports", stopWatch.ElapsedMilliseconds,
                                  ports.Length);

                stopWatch.Reset();
                stopWatch.Start();

                var x = session.Design("ports").ViewDocs <Destination>("by_id", new ViewQuery()
                {
                }).Documents;

                stopWatch.Stop();

                Console.WriteLine("Total time taken: {0}ms to fetch {1} ports", stopWatch.ElapsedMilliseconds,
                                  x.Length);

                stopWatch.Reset();
                stopWatch.Start();

                var y = session.Design("ports").ViewDocs <Destination>("by_id", new ViewQuery()
                {
                });

                stopWatch.Stop();

                Console.WriteLine("Total time taken: {0}ms to fetch {1} ports 1", stopWatch.ElapsedMilliseconds,
                                  y.Rows.Length);

                WebClient client = new WebClient();
                stopWatch.Reset();
                stopWatch.Start();

                client.DownloadString("http://localhost:5984/cruiseme/_design/ports/_view/by_id?include_docs=true");

                stopWatch.Stop();

                Console.WriteLine("Total time taken: {0}ms to fetch {1} ports", stopWatch.ElapsedMilliseconds,
                                  y.Rows.Length);
            }
        }
Пример #2
0
        public void run()
        {
            WebRequest.DefaultWebProxy = null;
            ServicePointManager.DefaultConnectionLimit = 80;

            using (
                var session = TheCouch.CreateSession("cruiseme", new Uri("http://127.0.0.1:5984"))
                )
            {
                var stopWatch = new Stopwatch();

                using (var webClient = new WebClientEx())
                {
                    // webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");
                    webClient.Proxy = null;
                    stopWatch.Reset();
                    stopWatch.Start();
                    webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");
                    stopWatch.Stop();

                    Console.WriteLine("Total time taken: {0}ms to fetch raw", stopWatch.ElapsedMilliseconds);

                    stopWatch.Reset();
                    stopWatch.Start();
                    webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");
                    stopWatch.Stop();

                    Console.WriteLine("Total time taken: {0}ms to fetch raw", stopWatch.ElapsedMilliseconds);
                }

                using (var webClient = new WebClientEx())
                {
                    // webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");

                    stopWatch.Reset();
                    stopWatch.Start();
                    webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");
                    stopWatch.Stop();

                    Console.WriteLine("Total time taken: {0}ms to fetch raw", stopWatch.ElapsedMilliseconds);

                    stopWatch.Reset();
                    stopWatch.Start();
                    webClient.DownloadString("http://127.0.0.1:5984/cruiseme/_design/destinations/_view/by_id");
                    stopWatch.Stop();

                    Console.WriteLine("Total time taken: {0}ms to fetch raw", stopWatch.ElapsedMilliseconds);
                }
            }
        }