ORM性能:是greenDAO比ORMLite快? [英] ORM performance: is greenDAO faster than ORMLite?

查看:417
本文介绍了ORM性能:是greenDAO比ORMLite快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用ORMLite在我的应用程序已经和我正在考虑是否采用greenDAO。

I've been using ORMLite in my application and I was considering whether to move to greenDAO.

性能是决定一个巨大的一部分, greenDAO的功能页面说:

Performance is a huge part of that decision, and greenDAO's Features page says:

有关同一给定的实体,greenDAO插入和更新实体过   2倍的速度,并加载实体更快装载4.5倍   实体比ORMLite。
  ...
  (图和图表更新2011年10月23号)

For the same given entity, greenDAO inserts and updates entities over 2 times faster, and loads entities 4.5 times faster for loading entities than ORMLite.
...
(Figures and chart updated 10-23-2011)

我觉得<一个href="http://ormlite.com/javadoc/ormlite-core/doc-files/ormlite_4.html#Config-Optimization">ORMLite's配置文件生成一步应该不再需要运行时用于反映。

I thought ORMLite's config file generation step should remove the need for reflection at runtime.

在ORMLite changlog 表明greenDAO基准做配置文件功能发布之后,但greenDAO功能页面没有按'牛逼明确地说,如果对测试产生一个静态的配置文件。

The ORMLite changlog suggests that the greenDAO benchmark was done after the config file feature was released, but the greenDAO features page doesn't explicitly say if a static config file was generated for the test.

4.26:2011/9/26(SVN r1978)
   *安卓:添加的字段配置实用程序,以避免道创作的性能问题,注释

4.26: 9/26/2011 (svn r1978)
* ANDROID: Added field configuration utility to avoid Dao creation performance problems with annotations.

已经有自那以后也一直ORMLite性能修复,如:

There have also been ORMLite performance fixes since then, e.g.

4.40:2012年4月16日(SVN r2516)
   * ANDROID:创建的DAO时,巨大的性能bug修复。洋田总是用来代替表的configs反映。

4.40: 4/16/2012 (svn r2516)
* ANDROID: Big performance bug fix when creating DAOs. Foreign fields always used reflection instead of table configs.

任何人都可以确认是否还有greenDAO和ORMLite之间有很大的性能差异?谢谢!

Can anybody confirm if there is still a big performance difference between greenDAO and ORMLite? Thanks!

推荐答案

我们刚刚发布了Github的项目,我们来比较ORMLite和GreenDao的原始SQLite的性能:
<一href="https://github.com/daj/android-orm-benchmark">https://github.com/daj/android-orm-benchmark

We've just published a Github project that we used to compare the performance of ORMLite and GreenDao to raw SQLite:
https://github.com/daj/android-orm-benchmark

该项目还可以让你的内存数据库的性能比较到磁盘上的一个。

The project also allows you to compare the performance of an in-memory database to an on disk one.

该标题的结果是:

GreenDao是的的比ORMLite 更快。这大致是:

GreenDao is much faster than ORMLite. It is roughly:

  • 快3倍,在写大量的对象。
  • 50%的速度在读取所有10000项的一个表。
  • 2到3倍快了单行的索引读取(虽然两者都是非常快)。
  • 15X更快的在做LIKE搜索100条记录的10000项表。

该项目包含一个天真的原始SQLite的标杆,和<一href="https://github.com/daj/android-orm-benchmark/commit/d5475afc403a076991a9fb85032c7438c4b40bcb#diff-2ce42ab35b0c823115cb2b284143d048R18">optimized SQLite的基准。

The project contains both a naive raw SQLite benchmark, and an optimized SQLite benchmark.

GreenDao VS的的优化原料的SQLite

GreenDao vs unoptimized raw SQLite

  • GreenDao是快2倍的写入基准。
  • GreenDao是读基准慢25%。

GreenDao VS优化原料的SQLite

  • GreenDao是读慢50%,写基准。

有关详细结果,请参见上面的Github上库。

For detailed results please see the Github repository above.

当然,我们可以在我们的基准测试code错误......如果你发现任何请叉,修复并提交拉请求! : - )

Of course we may have bugs in our benchmarking code...if you find any please fork, fix and submit a pull request! :-)

免责声明:请务必选择GreenDao超过ORMLite之前做自己的研究

Disclaimer: make sure you do your own research before choosing GreenDao over ORMLite.

这篇关于ORM性能:是greenDAO比ORMLite快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆