[ListMonitor] [subscript(safeSectionIndex:safeItemIndex:)] Use subscript(indexPath:) after the validation of sectionIndex and itemIndex to get an object.

There is a performance problem in Swift when getting an object from the Objective-C array with a large number of objects using subscript. It requires casting the array between Objective-C and Swift, that is pretty slow.
This commit is contained in:
Ruslan Skorb
2018-11-24 16:23:36 +02:00
parent 06c0981ded
commit ff8fbae568

View File

@@ -144,7 +144,7 @@ public final class ListMonitor<D: DynamicObject>: Hashable {
return nil
}
return ObjectType.cs_fromRaw(object: section.objects![itemIndex] as! NSManagedObject)
return self[IndexPath(indexes: [sectionIndex, itemIndex])]
}
/**