内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

DataVeryLite和Nhibernate性能對(duì)比

電腦型號(hào):acer 4752g

成都創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供永濟(jì)網(wǎng)站建設(shè)、永濟(jì)做網(wǎng)站、永濟(jì)網(wǎng)站設(shè)計(jì)、永濟(jì)網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、永濟(jì)企業(yè)網(wǎng)站模板建站服務(wù),10余年永濟(jì)做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

電腦配置:

DataVeryLite和Nhibernate性能對(duì)比


class Program
   {
       static void Main(string[] args)
       {
           Debug.Listeners.Add(new ConsoleTraceListener());
           ShowExecuteTime("dataverylteBatch", () => DataVeryLiteInsertBatch());

           ShowExecuteTime("dataverylte", () => DataVeryLiteInsert());
           ShowExecuteTime("hibernate", () => HibernateInsert());
           Console.WriteLine("完成");
           Console.ReadKey();
       }

       public static void HibernateInsert()
       {
           // 讀取配置
           var config = new Configuration().Configure("Database.xml");

           // 創(chuàng)建表結(jié)構(gòu)
           SchemaMetadataUpdater.QuoteTableAndColumns(config);
           new SchemaExport(config).Create(false, true);

           // 打開Session
           var sessionFactory = config.BuildSessionFactory();
           using (var session = sessionFactory.OpenSession())
           {
               // 插入
               for (int i = 0; i < 1000; i++)
               {
                   var user = new User();
                   user.Name = "賊寇在何方"+i;
                   user.Password = "********";
                   user.Email = "realh4@gmail.com";

                   session.Save(user);
                   session.Flush();
                   Debug.WriteLine("Nhibernate now is inserted " + i);
               }
           }
       }

       public static void DataVeryLiteInsert()
       {
           for (int i = 0; i < 1000; i++)
           {
               var user = new VeryLiteUser();
               user.Id = Guid.NewGuid().ToString();
               user.Name = "賊寇在何方" + i;
               user.Password = "********";
               user.Email = "realh4@gmail.com";
               user.Save(false);
               Debug.WriteLine("DataVeryLite now is inserted " + i);
           }
       }
       public static void DataVeryLiteInsertBatch()
       {
           Sqlite sqlite = new Sqlite();
           var tran= sqlite.BeginTransaction();
           var list = new  List<VeryLiteUser>();
           for (int i = 0; i < 1000; i++)
           {
               var user = new VeryLiteUser();
               user.Id = Guid.NewGuid().ToString();
               user.Name = "賊寇在何方" + i;
               user.Password = "********";
               user.Email = "realh4@gmail.com";
               list.Add(user);
               Debug.WriteLine("VeryLiteUser now is add to list " + i);
           }
           sqlite.SaveOnly<VeryLiteUser>(list, false, tran);
           tran.Commit();
       }

       public static void ShowExecuteTime(string name, Action action)
       {
           Console.ForegroundColor = ConsoleColor.Yellow;
           Console.WriteLine(name + " start,please wait.");
           Debug.WriteLine(name + " start,please wait.");
           int start = System.Environment.TickCount;
           action();
           int during = System.Environment.TickCount - start;
           Console.ForegroundColor = ConsoleColor.Red;
           Console.WriteLine(name + ":During time is " + during / 1000.0 + " s");
           Debug.WriteLine(name + ":During time is " + during / 1000.0 + " s");
           Console.WriteLine();
       }


插入條數(shù):1000條

結(jié)果:

dataverylteBatch:用時(shí)2.59秒
dataverylte:用時(shí)156.64秒
hibernate:用時(shí)145.58秒

源代碼(Demo)下載地址:http://files.cnblogs.com/shuqizhao/DataVeryLiteNHibernateSQLiteDemo.zip
DataVeryLite地址:http://dataverylite.codeplex.com/
歡迎吐槽!

網(wǎng)頁(yè)標(biāo)題:DataVeryLite和Nhibernate性能對(duì)比
網(wǎng)頁(yè)網(wǎng)址:http://www.rwnh.cn/article40/gpoieo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊(cè)、網(wǎng)站維護(hù)全網(wǎng)營(yíng)銷推廣、定制網(wǎng)站、做網(wǎng)站品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)
鄂尔多斯市| 山东省| 鲁山县| 芒康县| 凤冈县| 鄂托克旗| 临江市| 桑日县| 柘城县| 策勒县| 枣阳市| 泰宁县| 冕宁县| 神木县| 平利县| 布拖县| 昌图县| 麻阳| 大余县| 南阳市| 新丰县| 南溪县| 吉木乃县| 会东县| 瑞安市| 任丘市| 龙门县| 临西县| 深州市| 辽阳县| 酒泉市| 古丈县| 定西市| 青岛市| 河曲县| 游戏| 卢氏县| 吉木萨尔县| 盈江县| 松阳县| 巴里|