PSTFoundationBenchmark icon indicating copy to clipboard operation
PSTFoundationBenchmark copied to clipboard

added NSSortDescriptor option sort time

Open czakuma opened this issue 11 years ago • 2 comments

NSSortDescriptor is much faster than any other sort method available in NSArray. Here is the results on my computer .

2014-01-08 23:20:31.112 PSTFoundationBenchmark[36326:907] Sorting 1000000 elements. selector: 6926.93[ms] function: 9356.48[ms] block: 5662.77[ms] sortDescriptor: 2650.73[ms].

czakuma avatar Jan 09 '14 07:01 czakuma

Yes, you are right. The default is compare: and not localizedCaseInsensitiveCompare: Changing the selector to localizedCaseInsensitiveCompare: slows it to all the other sorting methods' speed with selector being the fastest.

czakuma avatar Jan 09 '14 19:01 czakuma

There you go. If you update your PR using the selector I'll merge it. It's another option and also interesting.

steipete avatar Jan 10 '14 11:01 steipete