If my Author
NSManagedObject
模型有一个authorID
属性(由服务器确定),将NSFetchRequest
表现更好,如果NSPredicate
过滤依据authorID
而不是完整的Author
目的?假设我正在获取所有内容Book
NSManagedObject
s 由一定author
. Which predicateFormat
更好?
[NSPredicate predicateWithFormat:@"author = %@", anAuthor]
or
[NSPredicate predicateWithFormat:@"author.authorID = %@", anAuthor.authorID]
描述这一点的最佳方式是什么?我正在使用核心数据测试OCUnit
(SenTestingKit
)。 iOS 有类似的东西吗Ruby 的基准测试模块 http://www.ruby-doc.org/stdlib-1.9.3/libdoc/benchmark/rdoc/Benchmark.html?
可能值得以以下参数运行您的应用程序-com.apple.CoreData.SQLDebug 1
,详细说明here http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html.
然后,您可以查看 Core Data 是否在两种情况下执行相同的 SQL(假设您使用的是 SQLite 存储)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)