在ormlite中,注释@DatabaseField
用于帮助创建数据库模式配置文件,然后它使用配置文件来引用模型对象中的变量,如果我理解正确的话。
Ormlite 文档说这是用作注释的替代方案,因为 java 反射 api 占用大量资源并导致大量垃圾收集,这是事实。这是否意味着我可以删除所有 @DatabaseField
行并且它会表现得更好?
最佳答案
The Ormlite documentation says this is used as an alternative for annotations because the java reflections api takes a lot of resources and causes a lot of garbage collection, which is true.
确实是这样。这是我关于这个主题的帖子:Why are annotations under Android such a performance issue (slow)?
Does this mean that I can remove all of my @DatabaseField lines and it will perform better?
没有。一旦有了配置文件,就根本不应该引用 @DatabaseField 注释。删除它们只会让您在更改架构时更难重新生成配置文件。
关于java - ORMlite,如果我*删除*注释会更快吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18666343/