Speed of search operation in a Realm database

左心房为你撑大大i 提交于 2019-12-02 03:28:05

Doing the search in Realm will always be faster since you can execute the entire search inside the C++ core. Doing the search yourself will mean you occur the overhead of going back and forth between Java and C++.

The only requirement for doing fast searching for single elements is that you have an @Index annotation on the field, but in your case you already have @PrimaryKey which automatically applies the @Index annotation as well.

So your query is as fast as it can be. Besides, for 10-100 objects, no matter what you do, it will probably appear instantaneous to the user.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!