I have to compare many managed objects and group them by date. I can't use NSDateComponents because it's too slow to compare two NSDate
objects.
How can I compare them in a more efficient way, so that I can save processing time?
I have to compare many managed objects and group them by date. I can't use NSDateComponents because it's too slow to compare two NSDate
objects.
How can I compare them in a more efficient way, so that I can save processing time?
I am not sure what kind of comparison you are doing but you can do:
if ( [date1 timeIntervalSince1970] > [date2 timeIntervalSince1970])
{
NSLOG(@"Do something");
}
so if date1 is bigger (further away for 1970!) than date2 the if is true. This will work quicker than NSDateComponents.