电脑型号:acer 4752g

电脑配置:

代码分享:

  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"); // 创建表结构
SchemaMetadataUpdater.QuoteTableAndColumns(config);
new SchemaExport(config).Create(false, true); // 打开Session
var sessionFactory = config.BuildSessionFactory();
using (var session = sessionFactory.OpenSession())
{
// 插入
for (int i = ; i < ; i++)
{
var user = new User();
user.Name = "贼寇在何方"+i;
user.Password = "********";
user.Email = "realh3@gmail.com"; session.Save(user);
session.Flush();
Debug.WriteLine("Nhibernate now is inserted " + i);
}
}
} public static void DataVeryLiteInsert()
{
for (int i = ; i < ; i++)
{
var user = new VeryLiteUser();
user.Id = Guid.NewGuid().ToString();
user.Name = "贼寇在何方" + i;
user.Password = "********";
user.Email = "realh3@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 = ; i < ; i++)
{
var user = new VeryLiteUser();
user.Id = Guid.NewGuid().ToString();
user.Name = "贼寇在何方" + i;
user.Password = "********";
user.Email = "realh3@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();
}

插入条数:1000条

结果:

dataverylteBatch:用时2.59秒
dataverylte:用时156.64秒
hibernate:用时145.58秒 源代码(Demo)下载地址:http://files.cnblogs.com/shuqizhao/DataVeryLiteNHibernateSQLiteDemo.zipDataVeryLite地址:http://dataverylite.codeplex.com/
欢迎吐槽!
 
 

DataVeryLite和Nhibernate性能对比的更多相关文章

  1. [原] KVM 环境下MySQL性能对比

    KVM 环境下MySQL性能对比 标签(空格分隔): Cloud2.0 [TOC] 测试目的 对比MySQL在物理机和KVM环境下性能情况 压测标准 压测遵循单一变量原则,所有的对比都是只改变一个变量 ...

  2. 浅谈C++之冒泡排序、希尔排序、快速排序、插入排序、堆排序、基数排序性能对比分析之后续补充说明(有图有真相)

    如果你觉得我的有些话有点唐突,你不理解可以想看看前一篇<C++之冒泡排序.希尔排序.快速排序.插入排序.堆排序.基数排序性能对比分析>. 这几天闲着没事就写了一篇<C++之冒泡排序. ...

  3. Java--Stream,NIO ByteBuffer,NIO MappedByteBuffer性能对比

    目前Java中最IO有多种文件读取的方法,本文章对比Stream,NIO ByteBuffer,NIO MappedByteBuffer的性能,让我们知道到底怎么能写出性能高的文件读取代码. pack ...

  4. C正则库做DNS域名验证时的性能对比

    C正则库做DNS域名验证时的性能对比   本文对C的正则库regex和pcre在做域名验证的场景下做评测. 验证DNS域名的正则表达式为: "^[0-9a-zA-Z_-]+(\\.[0-9a ...

  5. 开发语言性能对比,C++、Java、Python、LUA、TCC

    一直想做开发语言性能对比,刚好有时间都做了给大家参考一下, 编译类:C++和Java表现还不错 脚本类:TCC脚本动态运行C语言,性能比其他脚本快好多... 想玩TCC的同学下载测试包,TCC目录下修 ...

  6. php+mysql预查询prepare 与普通查询的性能对比

    prepare可以解决大访问量的网站给数据库服务器所带来的负载和开销,本文章通过实例向大家介绍预查询prepare与普通查询的性能对比,需要的朋友可以参考一下. 实例代码如下: <?php cl ...

  7. 不同Framework下StringBuilder和String的性能对比,及不同Framework性能比(附Demo)

    本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 阅读目录 介绍 环境搭建 测试用例 MSDN说明 ...

  8. ArrayList和LinkedList的几种循环遍历方式及性能对比分析(转)

    主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性能测试对比,根据ArrayList和LinkedList的源码实现分析性能结果,总结结论. 通过本文你可以 ...

  9. ArrayList和LinkedList的几种循环遍历方式及性能对比分析

    最新最准确内容建议直接访问原文:ArrayList和LinkedList的几种循环遍历方式及性能对比分析 主要介绍ArrayList和LinkedList这两种list的五种循环遍历方式,各种方式的性 ...

随机推荐

  1. 使用dom4j来处理xml的一些常用方法

    要使用dom4j读写XML文档,需要先下载dom4j包,dom4j官方网站在 http://www.dom4j.org/ 解开后有两个包,仅操作XML文档的话把dom4j-1.6.1.jar加入工程就 ...

  2. hdu 1418(抱歉)(欧拉公式,定点数,棱数,面数的关系)(水题)

    抱歉 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submiss ...

  3. Js跨域小总结

    教程 以下的例子包含的文件均为为http://www.a.com/a.html.http://www.a.com/c.html 与http://www.b.com/b.html ,要做的都是从a.ht ...

  4. hdu1845 Jimmy’s Assignment --- 完整匹配

    意甲冠军: 它需要一个特殊的图,以找到最大匹配.该图的特征是:无向图,度的每个节点3.这是一个双边连接组件(the graph is 2-edge-connected (that is, at lea ...

  5. STL序列容器之vector

    一,vector容器简介 1.vector容器的原理 vector是将元素置于一个动态数组中加以管理的容器. 2.vector容器的特点 vector容器可以随机存取元素,支持索引存取(即用数组下标的 ...

  6. Logical partitioning and virtualization in a heterogeneous architecture

    A method, apparatus, and computer usable program code for logical partitioning and virtualization in ...

  7. 【cocos2d-js官方文档】五、Cocos2d-JS v3.0的新Action API

    新增action中的方法 曾经,当我们须要反复一个action的时候,我们须要: sprite.runAction(cc.Repeat.create(action, 2)); 上面代码中创建了一个新的 ...

  8. 微服务实践之路--RPC

    微服务实践之路--RPC 重点来了,本文全面阐述一下我们的RPC是怎么实现并如何使用的,跟Kubernetes和Openstack怎么结合. 在选型一文中说到我们选定的RPC框架是Apache Thr ...

  9. 关于禅道提示未安装VC++环境的问题(做个记录)

    明明安装了VC++环境,总是提示未安装,这个问题有可能是你的mysql或其他服务开启影响的,关闭服务就可以了! 我这边是这个问题,把mysql和其他一些服务停止就好了.

  10. Java程序猿的书面采访String3

    public class SameString { //思想二:每个字符都相应着自己的ASC码,第一个思想的算法复杂度为O(nlogn).一般能够利用空间来减少时间复杂度 //能够开辟一个大小为256 ...