c# 国内外ORM 框架 dapper efcore sqlsugar freesql hisql sqlserver数据常规插入测试性能对比对比
在6.22 号发布了 c# sqlsugar,hisql,freesql orm框架全方位性能测试对比 sqlserver 性能测试 引起了很多争议
声明
首先我还是要做一下声明,测的都是开源软件,都是有开源协议的,而且测试源码已经开放不存在有故意黑的主观意图,测试结果仅为博主的电脑的配置测试的结果为测试结果呈现,测试结果不为最终结果。如果有意见请文明反馈,不接受任何形式的威胁与删博!!!
上次有部分网友说要对比一下efcore 和dapper的对比测试。那么这次来一次国内外ORM进行测试对比。
不过有点遗憾的是 目前dapper 和efcore 官方包中没有bulkcopy的功能(第三方插件有),因为官方没有如果拿第三方插件来做bulkcopy的对比这样有失公允,所以本次测试不测bulkcopy的,如果网友有比较认可的第三方插件那么下一次安排上。
经过上一次的测试经验 这次博主用两台电脑测试 两台电脑的配置如下
测试方案
- 因为不同的列插入的性能和时间肯定是有差别的本测试采用10列以下的数据集和50列的数据集进行测试
- 从5,50,100,500,1000,5000,10000,50000,100000 的数据阶段进行对比测试
- 为了防止有人说一台电脑测试不准,那么这次使用两台相同配置的电脑进行对比测试
- 测试的源码 上传到github
- 所有相关ORM的包都通过nuget安装最新版本2022.6.28前发布的
- 运行的测试程序都是在release环境运行
- 多个ORM同时运行,如果有影响那么整体相互影响测试相对是公平的
- 每个ORM插入的是独立的专用表,但结构是一模一样(不存在表不同的问题)
测试源码https://github.com/tansar/HiSqlTestDemo
测试结果
废话不多说先看测试结果,以下测试结果对排名进行不同颜色区分以下是颜色区分的图示

第一台电脑测试结果
dapper efcore hisql sqlsugar freesql10列以下的常规数据插入测试结果

这个测试结果有没有让人很意外 efcore说实在的在很多网友的印象中应该还算是不错的,结果测试出来...(不会有人说我在黑efcore吧) 我只是基于这个测试结果来说
dapper efcore hisql sqlsugar freesql 50列常规数据插入测试结果

50列的 efcore 就更加明显了 ,至于排名我请大家自己评判吧
好了, 这是第一台测试电脑的结果
第二台电脑测试结果
dapper efcore hisql sqlsugar freesql10列以下的常规数据插入测试结果

这台电脑的配置排名相对于第一台电脑有一点变化
dapper efcore hisql sqlsugar freesql 50列常规数据插入测试结果

第一台电脑的测试明细截图
第一台电脑5条10列以下插入截图

第一台电脑50条10列以下插入截图

第一台电脑100条10列以下插入截图

第一台电脑500条10列以下插入截图

第一台电脑1000条10列以下插入截图

第一台电脑5000条10列以下插入截图

第一台电脑10000条10列以下插入截图

第一台电脑50000条10列以下插入截图

第一台电脑100000条10列以下插入截图

第一台电脑5条50列插入截图

第一台电脑50条50列插入截图

第一台电脑100条50列插入截图

第一台电脑500条50列插入截图

第一台电脑1000条50列插入截图

第一台电脑5000条50列插入截图

第一台电脑10000条50列插入截图

第一台电脑50000条50列插入截图

第一台电脑100000条50列插入截图

第二台电脑的测试明细截图
第二台电脑5条10列以下插入截图

第二台电脑50条10列以下插入截图

第二台电脑100条10列以下插入截图

第二台电脑500条10列以下插入截图

第二台电脑1000条10列以下插入截图

第二台电脑5000条10列以下插入截图

第二台电脑10000条10列以下插入截图

第二台电脑50000条10列以下插入截图

第二台电脑100000条10列以下插入截图

第二台电脑5条50列插入截图

第二台电脑50条50列插入截图

第二台电脑100条50列插入截图

第二台电脑500条50列插入截图

第二台电脑1000条50列插入截图

第二台电脑5000条50列插入截图

第二台电脑10000条50列插入截图

第二台电脑50000条50列插入截图

第二台电脑100000条50列插入截图

测试电脑配置
两台一模一样配置电脑
第一台电脑配置
内存,CPU 相关配置

sqlserver 版本信息

第二台电脑配置
内存,CPU 相关配置

sqlserver 版本信息

总结
本测试结果仅作参考,在不同的电脑环境可能体现出来的测试结果可能有差异,但整体排名差不大
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |