|
|
|
|
|
by tolmasky
4332 days ago
|
|
Yeah, not to mention that NSMutableArray is not necessarily an array in Objective-C, see: http://ridiculousfish.com/blog/posts/array.html . It really seems like this benchmark is comparing different framework approaches more than any "core language speed" (similar to comparing stl::vector sort of ints in Objective-C++ to NSMutableArray sort of NSNumbers) Just looking at the "std lib sort", what this might actually be testing off the top of my head is: 1. C-style-array access/write speed of "native arrays" vs. potentially hash-mappy access/write speed of array-like NSMutableArrays. 2. Direct integer comparison (a < b) vs -[NSNumber compare:] method dispatch speed. 3. I don't know how sorted() is implemented internally in Swift, but given that no comparison method is being passed in, you may also be comparing a fast internal int[] sort that directly compares ints to the speed of calling the NSComparisonResult lambda O(n lg n) times. |
|