一、使用http://www.nuget.org/packages/LevelDB.NET 测试

  1、新建项目,并Nuget引入库:

    

  2、写代码

using LevelDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; namespace LevelDBDemo
{
class Program
{
static void Main(string[] args)
{
WriteTest();
}
public static void WriteTest()
{
var db = LevelDB.DB.Open("c:\\works\\mydb", new Options { CreateIfMissing = true }); System.Diagnostics.Stopwatch sp = new System.Diagnostics.Stopwatch();
sp.Reset();
sp.Start();
long mCount = ;
while (true)
{
db.Put(WriteOptions.Default, Guid.NewGuid().ToString(), "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaeraaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
if (System.Threading.Interlocked.Increment(ref mCount) % == )
{
Console.WriteLine("{0} has inserted. time use {1}ms.", mCount, sp.ElapsedMilliseconds);
}
}
}
}
}

  3、看效果:我的机器上配置不怎么好,大约5000条/秒。

 has inserted. time use 1968ms.
has inserted. time use 3996ms.
has inserted. time use 6032ms.
has inserted. time use 7969ms.
has inserted. time use 10465ms.
has inserted. time use 12932ms.
has inserted. time use 14914ms.
has inserted. time use 17161ms.
has inserted. time use 19351ms.
has inserted. time use 21431ms.
has inserted. time use 23572ms.
has inserted. time use 25277ms.
has inserted. time use 27174ms.
has inserted. time use 29311ms.
has inserted. time use 31577ms.
has inserted. time use 33539ms.
has inserted. time use 36045ms.
has inserted. time use 37894ms.
has inserted. time use 40296ms.
has inserted. time use 42255ms.
has inserted. time use 44752ms.
has inserted. time use 46432ms.
has inserted. time use 48524ms.
has inserted. time use 50457ms.
has inserted. time use 52648ms.
has inserted. time use 54896ms.
has inserted. time use 57293ms.
has inserted. time use 59354ms.
has inserted. time use 61576ms.
has inserted. time use 63735ms.
has inserted. time use 65710ms.
has inserted. time use 67867ms.
has inserted. time use 69724ms.
has inserted. time use 71691ms.
has inserted. time use 74123ms.
has inserted. time use 76347ms.
has inserted. time use 78387ms.
has inserted. time use 80481ms.
has inserted. time use 82766ms.
has inserted. time use 84601ms.
has inserted. time use 86751ms.
has inserted. time use 88961ms.
has inserted. time use 91061ms.
has inserted. time use 93445ms.
has inserted. time use 95739ms.
has inserted. time use 97735ms.
has inserted. time use 99911ms.
has inserted. time use 102113ms.
has inserted. time use 104124ms.
has inserted. time use 106092ms.
has inserted. time use 107903ms.
has inserted. time use 112400ms.
has inserted. time use 114539ms.
has inserted. time use 339741ms.
has inserted. time use 342317ms.
has inserted. time use 344162ms.

二、修改引用库:

  http://www.meebey.net/projects/leveldb-sharp/

  https://github.com/meebey/leveldb-sharp

  注意,需要把leveldb.dll放在程序目录下。这个文件可以通过下载https://www.nuget.org/packages/LevelDB.Net/ 中的dll,然后反编译,取得里面的资源。

  同时引入:

  2、代码和前面的相同

  3、运行结果:

  

  

  效果还不错,大约是6.6w条/秒。

C#中使用多款LevelDB.Net封装测试性能的更多相关文章

  1. 使用Spring.net中对Ado.net的抽象封装来访问数据库

    使用Spring.net中对Ado.net的抽象封装来访问数据库     Spring.NET是一个应用程序框架,其目的是协助开发人员创建企业级的.NET应用程序.它提供了很多方面的功能,比如依赖注入 ...

  2. OpenGl中的Nurbs B样条曲面的封装的GLU的NURBS的接口

    OpenGl中的Nurbs B样条曲面的封装的GLU的NURBS的接口 创建一个NURBS对象: GLUnurbs* gluNewNurbsRenderer (void); //创建一个NURBS对象 ...

  3. angular开发中对请求数据层的封装

    代码地址如下:http://www.demodashi.com/demo/11481.html 一.本章节仅仅是对angular4项目开发中数据请求封装到model中 仅仅是在项目angular4项目 ...

  4. selenium3 web自动化测试框架 三:项目实战中PO模型的设计与封装

    po模型设计思想 Page Object 模式主要是将每个页面设计为一个class,其中包含页面中的需要测试的元素(按钮,输入框,标题等),这样在Selenium测试页面中可以通过调取页面类来获取页面 ...

  5. Python面向对象中的继承、多态和封装

    Python面向对象中的继承.多态和封装 一.面向对象的三大特性 封装:把很多数据封装到⼀个对象中,把固定功能的代码封装到⼀个代码块, 函数,对象, 打包成模块. 这都属于封装思想. 继承:⼦类可以⾃ ...

  6. Linux下四款Web服务器压力测试工具(http_load、webbench、ab、siege)介绍

    一.http_load程序非常小,解压后也不到100Khttp_load以并行复用的方式运行,用以测试web服务器的吞吐量与负载.但是它不同于大多数压力测试工具,它可以以一个单一的进程运行,一般不会把 ...

  7. metasploit 一款开源的渗透测试框架

    渗透神器漏洞利用框架metasploit from: https://zhuanlan.zhihu.com/p/30743401 metasploit是一款开源的渗透测试框架软件也是一个逐步发展与成熟 ...

  8. 开源一款超实用的 Dubbo 测试工具,已用半年,感觉很有feel~

    不知道你是否在工作中有遇到过类似情况: dubbo接口调试复杂,需要通过telnet命令或者通过consumer调用来触发. telnet语句参数格式复杂,每次编写都要小心谨慎,一旦出错又需重来. 复 ...

  9. 如何在springMVC 中对REST服务使用mockmvc 做测试

    如何在springMVC 中对REST服务使用mockmvc 做测试 博客分类: java 基础 springMVCmockMVC单元测试  spring 集成测试中对mock 的集成实在是太棒了!但 ...

随机推荐

  1. C#编程(十九)----------部分类

    部分类 C#中使用关键字partial把类,结构或结构放在多个文件中.一般情况下,一个类全部驻留在单个文件中.但有时候,多个开发人员需要访问同一个类,或者某种类型的代码生成器生成了一个类的某部分,所以 ...

  2. Spring Boot中application.yml与bootstrap.yml的区别(转载)

    说明:其实yml和properties文件是一样的原理,主要是说明application和bootstrap的加载顺序.且一个项目上要么yml或者properties,二选一的存在. Bootstra ...

  3. Ubuntu下搭建Hyperledger Fabric v1.0环境

      多次尝试才正常启动了Fabric,如遇到各种莫名错误,请参考如下一步步严格安装,特别用户权限需要注意. 一.安装Ubuntu16 虚拟机或双系统,虚拟机有VirtualBox或者VMware,Ub ...

  4. 字符串中单词的逆转,即将单词出现的顺序进行逆转。如将“Today is Friday!”逆转为“Friday! is Today”.

    字符串中单词的逆转,即将单词出现的顺序进行逆转.如将“Today is Friday!”逆转为“Friday! is Today”. #include<iostream> #include ...

  5. Unit Testing of Spring MVC Controllers: “Normal” Controllers

    Original link: http://www.petrikainulainen.net/programming/spring-framework/unit-testing-of-spring-m ...

  6. json传输二进制的方案【转】

    本文转自:http://wiyi.org/binary-to-string.html json 是一种很简洁的协议,但可惜的是,它只能传递基本的数型(int,long,string等),但不能传递by ...

  7. [leetcode]Palindrome Partitioning @ Python

    原题地址:https://oj.leetcode.com/problems/palindrome-partitioning/ 题意: Given a string s, partition s suc ...

  8. 超链接a标签的href与onclick中使用javascript的区别

    onclick中javascript的区别一般没用到都没注意,但出错时才有些郁闷,看文本章解释如下: 以前一直很随意,后来看.net里的linkbutton似乎是用在<a href=" ...

  9. 转:使用RNN解决NLP中序列标注问题的通用优化思路

    http://blog.csdn.net/malefactor/article/details/50725480 /* 版权声明:可以任意转载,转载时请标明文章原始出处和作者信息 .*/ author ...

  10. .NET MVC-去掉验证

    将@Html.ValidationMessage("sortid")代码去掉 将if (ModelState.IsValid)验证代码去掉