How can I improve core data fetch performance on the iPhone?

前端 未结 4 451
不知归路
不知归路 2021-02-01 11:06

Core data\'s performance on the iPhone is absolutely miserable. Is indexing completely broken or is it just a poor implementation?

I have about 21500 objects of a single

4条回答
  •  没有蜡笔的小新
    2021-02-01 11:56

    I think the problem is comparing strings is much slower then comparing numbers for most if not all database.

    You can try to add a new property (column), aNumber, for your NSManagedObject, which is a number and value is generated from it's UUID.

    Then, build your query like "aNumber == XXX AND uuid == UUID"

    This can make the database to compare a number first and it only has to compare a string if the number is same.

    OR, you can try to index the UUID.

提交回复
热议问题