Ios 访问NSFetchedResultsSectionInfo对象的速度比第200节慢得多

Ios 访问NSFetchedResultsSectionInfo对象的速度比第200节慢得多,ios,swift,nsfetchedresultscontroller,Ios,Swift,Nsfetchedresultscontroller,我有一个包含数百个部分的大型集合视图。访问NSFetchedResultsSectionInfo“对象对于第0节到第199节大约需要3毫秒 从第200节开始,它从3毫秒跳到110毫秒左右,并在更高的部分保持不变 extension NSFetchedResultsController { func objectAtIndexPath(_ indexPath: IndexPath) throws -> AnyObject { let section = sec

我有一个包含数百个部分的大型集合视图。访问
NSFetchedResultsSectionInfo
对象
对于第0节到第199节大约需要3毫秒

从第200节开始,它从3毫秒跳到110毫秒左右,并在更高的部分保持不变

extension NSFetchedResultsController
{
    func objectAtIndexPath(_ indexPath: IndexPath) throws -> AnyObject
    {
        let section = sections[indexPath.section]
        guard indexPath.item < section.numberOfObjects else
        {
            throw FetchableError.outOfRange
        }

        guard let sectionObjects = section.objects else // This line 110ms.
        {
            throw FetchableError.outOfRange
        }

        return sectionObjects[indexPath.item] as AnyObject
    }
}
扩展NSFetchedResultsController
{
func objectAtIndexPath(\uindexath:indexPath)抛出->任何对象
{
let section=sections[indexPath.section]
guard indexath.item

有什么想法吗?

NSFetchedResultsController
已经有了一个方法,为什么您必须自己实现它?另外,表/集合视图不应该要求索引路径不在FRC当前结果集中的项。您是否试图解决集合视图和FRC不同步的问题?@MartinR我同意;这是带有“未知问题”的遗留代码。至少,使用
对象(At:)
可以修复延迟。但是,你知道为什么访问>=200的部分会这么慢吗?不,我不知道——但我从来没有在这么多的部分中使用过集合视图。