views:

84

answers:

1

Is that thing using bubble sort? Or what exactly? How does it work in context with an NSFetchRequest of Core Data?

+4  A: 
  1. The NSSortDescriptor API does not specify the algorithm (or even, like virtually all of the Cocoa APIs, a Big-O complexity guarantee). You should assume that the sort algorithm used is an implementation detail. You should probably also assume, however, that the algorithm used is selected at run time for best performance. Unless you have hard requirements for time or memory complexity, you should use the public API and let the framework authors at Apple worry abou the details.

    If you have complexity requirements, you may find CHDataStructures framework helpful in writing your own collection/sorting implementation.

  2. For NSFetchRequest, you should again assume that it is choosing an appropriate sort algorithm. In particular, sorting will be done by the SQLite engine, if possible, when using a SQL persistent store with Core Data.

Barry Wark