电脑型号: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. 利用WPF建立自己的3d gis软件(非axhost方式)(三)矢量数据显示控制

    原文:利用WPF建立自己的3d gis软件(非axhost方式)(三)矢量数据显示控制 先下载SDK:https://pan.baidu.com/s/1M9kBS6ouUwLfrt0zV0bPew 密 ...

  2. cocos2d-x 调色

    在游戏开发.我们须要实现闪光的灯.照明弹效果等等,我么你能够採用混合模式来实现. 假设学习过OpenGL(ES),就知道里面使用glBlendFunc函数实现的.在cocos2d-x里肯定也有,对于精 ...

  3. dot net core 使用 usb

    原文:dot net core 使用 usb 本文告诉大家如何在 dot net core 使用 usb 目录 获得通知 读写 串口通信 LGPL 首先需要打开 Nuget 安装 CoreCompat ...

  4. scipy 图像处理(scipy.misc、scipy.ndimage)、matplotlib 图像处理

    from scipy.misc import imread / imsave / imshow imresize / imrotate / imfilter 1. scipy.misc 下的图像处理 ...

  5. 《modern operating system》 chapter 5 Input and output 注意事项

    Input / Output It should also provide an interface between the devices and the rest of the system th ...

  6. 学习 NLP(一)—— TF-IDF

    TF-IDF(Term Frequency & Inverse Document Frequency),是一种用于信息检索与数据挖掘的常用加权技术.它的主要思想是:如果某个词或短语在一篇文章中 ...

  7. python 获取字典值

    一.Python中的字典遍历方法: info = { 'name':'xiaoming', 'sex':'nan', 'age':20, 'id':1} info2 = { 'name':'hhh', ...

  8. Blend_技巧篇_淡入淡出

    原文:Blend_技巧篇_淡入淡出 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/u010265681/article/details/766517 ...

  9. 希尔伯特空间(Hilbert Space)

    欧氏空间 → 线性空间 + 内积 ⇒ 内积空间(元素的长度,元素的夹角和正交) 内积空间 + 完备性 ⇒ 希尔伯特空间 0. 欧几里得空间 欧氏空间是一个特别的度量空间,它使得我们能够对其的拓扑性质, ...

  10. asp .net Cookies

    Request.Cookies和Response.Cookies When validating cookies or cookie data from the browser you should ...